summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-27 12:41:37 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-27 12:41:37 +0000
commit987f8aa257540aa310cd029f9b6c914700095ede (patch)
treee579e780c3d435f5caf393adb55777bbdbdb0c7a /django
parentbcb088b558df207905af2db5c5691b4148f9a1c8 (diff)
Fixed #3985 -- Added support for custom email headers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/mail.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/core/mail.py b/django/core/mail.py
index cf8b5fec13..2d9a400db5 100644
--- a/django/core/mail.py
+++ b/django/core/mail.py
@@ -173,13 +173,14 @@ class EmailMessage(object):
multipart_subtype = 'mixed'
def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
- connection=None, attachments=None):
+ connection=None, attachments=None, headers=None):
self.to = to or []
self.bcc = bcc or []
self.from_email = from_email or settings.DEFAULT_FROM_EMAIL
self.subject = subject
self.body = body
self.attachments = attachments or []
+ self.extra_headers = headers or {}
self.connection = connection
def get_connection(self, fail_silently=False):
@@ -206,6 +207,8 @@ class EmailMessage(object):
msg['Message-ID'] = make_msgid()
if self.bcc:
msg['Bcc'] = ', '.join(self.bcc)
+ for name, value in self.extra_headers.items():
+ msg[name] = value
return msg
def recipients(self):