fix(mailing): don't default to empty string for smtp_password and user, since mailing lib only expects None as empty values
This commit is contained in:
parent
632140ed6c
commit
e23ad22b70
1 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
# Copyright (C) 2012-2024 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License, version 3
|
||||
|
|
@ -64,8 +64,9 @@ def send_email(recipients, subject, body='', html_body='', email_config=None,
|
|||
"Make sure that `smtp_server` variable is configured "
|
||||
"inside the .ini file")
|
||||
return False
|
||||
|
||||
subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
|
||||
conf_prefix = email_config.get('email_prefix', None)
|
||||
prefix = f'{conf_prefix} ' if conf_prefix else ''
|
||||
subject = f"{prefix}{subject}"
|
||||
|
||||
if recipients:
|
||||
if isinstance(recipients, str):
|
||||
|
|
@ -86,8 +87,8 @@ def send_email(recipients, subject, body='', html_body='', email_config=None,
|
|||
email_conf = dict(
|
||||
host=mail_server,
|
||||
port=email_config.get('smtp_port', 25),
|
||||
username=email_config.get('smtp_username'),
|
||||
password=email_config.get('smtp_password'),
|
||||
username=email_config.get('smtp_username', None),
|
||||
password=email_config.get('smtp_password', None),
|
||||
|
||||
tls=str2bool(email_config.get('smtp_use_tls')),
|
||||
ssl=str2bool(email_config.get('smtp_use_ssl')),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue