1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #9233 -- Allow date and message-id headers to be passed in manually in

email messages. Previously we were creating duplicate headers, which was bad.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2008-10-07 12:20:01 +00:00
parent 72f387d344
commit 70b6c4c015
2 changed files with 16 additions and 2 deletions

View File

@@ -247,8 +247,14 @@ class EmailMessage(object):
msg['Subject'] = self.subject
msg['From'] = self.from_email
msg['To'] = ', '.join(self.to)
msg['Date'] = formatdate()
msg['Message-ID'] = make_msgid()
# Email header names are case-insensitive (RFC 2045), so we have to
# accommodate that when doing comparisons.
header_names = [key.lower() for key in self.extra_headers]
if 'date' not in header_names:
msg['Date'] = formatdate()
if 'message-id' not in header_names:
msg['Message-ID'] = make_msgid()
for name, value in self.extra_headers.items():
msg[name] = value
return msg