Add set_from_header in email tools

issue10753
review377121002
This commit is contained in:
Cédric Krier committed 2021-09-26 23:11:21 +02:00
1 parent 0ab745eef6
commit 02958ade08
1 file changed
+2 -1
+2 -1
View File
@@ -32,6 +32,7 @@ from trytond.pool import Pool
from trytond.pyson import Eval
from trytond.report import Report, get_email
from trytond.transaction import Transaction
from trytond.tools.email_ import set_from_header
from trytond.sendmail import sendmail_transactional
from trytond.ir.session import token_hex
@@ -44,7 +45,7 @@ def _send_email(from_, users, email_func):
from_cfg = config.get('email', 'from')
for user in users:
msg, title = email_func(user)
msg['From'] = from_ or from_cfg
set_from_header(msg, from_cfg, from_ or from_cfg)
msg['To'] = user.email
msg['Subject'] = Header(title, 'utf-8')
sendmail_transactional(from_cfg, [user.email], msg)