##// END OF EJS Templates
fix(mailing): don't default to empty string for smtp_password and user, since mailing lib only expects None as empty values
super-admin -
r5488:186b51dd default
parent child Browse files
Show More
@@ -1,4 +1,4 b''
1 # Copyright (C) 2012-2023 RhodeCode GmbH
1 # Copyright (C) 2012-2024 RhodeCode GmbH
2 #
2 #
3 # This program is free software: you can redistribute it and/or modify
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
4 # it under the terms of the GNU Affero General Public License, version 3
@@ -64,8 +64,9 b' def send_email(recipients, subject, body'
64 "Make sure that `smtp_server` variable is configured "
64 "Make sure that `smtp_server` variable is configured "
65 "inside the .ini file")
65 "inside the .ini file")
66 return False
66 return False
67
67 conf_prefix = email_config.get('email_prefix', None)
68 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
68 prefix = f'{conf_prefix} ' if conf_prefix else ''
69 subject = f"{prefix}{subject}"
69
70
70 if recipients:
71 if recipients:
71 if isinstance(recipients, str):
72 if isinstance(recipients, str):
@@ -86,8 +87,8 b' def send_email(recipients, subject, body'
86 email_conf = dict(
87 email_conf = dict(
87 host=mail_server,
88 host=mail_server,
88 port=email_config.get('smtp_port', 25),
89 port=email_config.get('smtp_port', 25),
89 username=email_config.get('smtp_username'),
90 username=email_config.get('smtp_username', None),
90 password=email_config.get('smtp_password'),
91 password=email_config.get('smtp_password', None),
91
92
92 tls=str2bool(email_config.get('smtp_use_tls')),
93 tls=str2bool(email_config.get('smtp_use_tls')),
93 ssl=str2bool(email_config.get('smtp_use_ssl')),
94 ssl=str2bool(email_config.get('smtp_use_ssl')),
General Comments 0
You need to be logged in to leave comments. Login now