diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -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 "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 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')),