Commit 88d40b40 authored by Jérome Perrin's avatar Jérome Perrin

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

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