##// END OF EJS Templates
mail: use faster detection of email misconfiguration. This should be done at earliest...
marcink -
r3077:6903e671 default
parent child Browse files
Show More
@@ -49,6 +49,14 b' def send_email(recipients, subject, body'
49 log = get_logger(send_email)
49 log = get_logger(send_email)
50
50
51 email_config = email_config or rhodecode.CONFIG
51 email_config = email_config or rhodecode.CONFIG
52
53 mail_server = email_config.get('smtp_server') or None
54 if mail_server is None:
55 log.error("SMTP server information missing. Sending email failed. "
56 "Make sure that `smtp_server` variable is configured "
57 "inside the .ini file")
58 return False
59
52 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
60 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
53 if not recipients:
61 if not recipients:
54 # if recipients are not defined we send to email_config + all admins
62 # if recipients are not defined we send to email_config + all admins
@@ -62,13 +70,6 b' def send_email(recipients, subject, body'
62 recipients += [config_email]
70 recipients += [config_email]
63 recipients += admins
71 recipients += admins
64
72
65 mail_server = email_config.get('smtp_server') or None
66 if mail_server is None:
67 log.error("SMTP server information missing. Sending email failed. "
68 "Make sure that `smtp_server` variable is configured "
69 "inside the .ini file")
70 return False
71
72 mail_from = email_config.get('app_email_from', 'RhodeCode')
73 mail_from = email_config.get('app_email_from', 'RhodeCode')
73 user = email_config.get('smtp_username')
74 user = email_config.get('smtp_username')
74 passwd = email_config.get('smtp_password')
75 passwd = email_config.get('smtp_password')
General Comments 0
You need to be logged in to leave comments. Login now