Skip to content

Commit

Permalink
Merge pull request #3784 from ggcatu/3781-fix-mail-header
Browse files Browse the repository at this point in the history
Fix replace, add
  • Loading branch information
wardi committed Aug 29, 2017
2 parents 9565c49 + 627d7ba commit 3b5e33b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ckan/lib/mailer.py
Expand Up @@ -8,7 +8,6 @@
from email.mime.text import MIMEText
from email.header import Header
from email import Utils
from urlparse import urljoin

from ckan.common import config
import paste.deploy.converters
Expand All @@ -33,7 +32,10 @@ def _mail_recipient(recipient_name, recipient_email,
mail_from = config.get('smtp.mail_from')
msg = MIMEText(body.encode('utf-8'), 'plain', 'utf-8')
for k, v in headers.items():
msg[k] = v
if k in msg.keys():
msg.replace_header(k, v)
else:
msg.add_header(k, v)
subject = Header(subject.encode('utf-8'), 'utf-8')
msg['Subject'] = subject
msg['From'] = _("%s <%s>") % (sender_name, mail_from)
Expand Down

0 comments on commit 3b5e33b

Please sign in to comment.