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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user