Commit 88d40b40 by Jérome Perrin

Notification: use email.utils.formataddr instead of reimplementing it

1 parent 6edd92c8
......@@ -40,6 +40,7 @@ from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.mime.audio import MIMEAudio
from email.mime.image import MIMEImage
from email.utils import formataddr
from email.header import make_header
from email import encoders
......@@ -333,8 +334,7 @@ class NotificationTool(BaseTool):
default_from_name = getattr(portal, 'email_from_name', default_from_name)
if from_person is None:
# when sending without sender defined compose identifiable From header
low_level_kw['from_url'] = '%s <%s>' % (default_from_name,
default_from_email)
low_level_kw['from_url'] = formataddr((default_from_name, default_from_email))
if not to_person_list:
low_level_kw['to_url'] = default_to_email
if attachment_list is not None:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!