diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-27 12:54:15 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-27 12:54:15 +0000 |
| commit | eeb4ffc2c1b9baaf9f8e87d14e24b1679f98f7b7 (patch) | |
| tree | 59b954264362d446313d6223555b3f2172756da3 | |
| parent | 26659f2782c919a640e33e4566ffe61712f4ea24 (diff) | |
Fixed #2007 -- Added support for configurable encoding of email message bodies.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/mail.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/mail.py b/django/core/mail.py index 2d9a400db5..e9d8a150a1 100644 --- a/django/core/mail.py +++ b/django/core/mail.py @@ -171,6 +171,7 @@ class EmailMessage(object): """ content_subtype = 'plain' multipart_subtype = 'mixed' + encoding = None # None => use settings default def __init__(self, subject='', body='', from_email=None, to=None, bcc=None, connection=None, attachments=None, headers=None): @@ -189,7 +190,8 @@ class EmailMessage(object): return self.connection def message(self): - msg = SafeMIMEText(self.body, self.content_subtype, settings.DEFAULT_CHARSET) + encoding = self.encoding or settings.DEFAULT_CHARSET + msg = SafeMIMEText(self.body, self.content_subtype, encoding) if self.attachments: body_msg = msg msg = SafeMIMEMultipart(_subtype=self.multipart_subtype) |
