From 4dc66f6f7c73c2e097aa527a8294e6d2cd6787ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 3 Feb 2021 23:26:07 +0100 Subject: [PATCH] Allow distinct FROM addresses for envelope and header issue9948 review324741004 --- trytond/res/user.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trytond/res/user.py b/trytond/res/user.py index 752f8063db..e54892910a 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -79,17 +79,16 @@ def gen_password(length=8): def _send_email(from_, users, email_func): - if from_ is None: - from_ = config.get('email', 'from') + from_cfg = config.get('email', 'from') for user in users: if not user.email: logger.info("Missing address for '%s' to send email", user.login) continue msg, title = email_func(user) - msg['From'] = from_ + msg['From'] = from_ or from_cfg msg['To'] = user.email msg['Subject'] = Header(title, 'utf-8') - sendmail_transactional(from_, [user.email], msg) + sendmail_transactional(from_cfg, [user.email], msg) class PasswordError(UserError):