mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
26659f2782
commit
eeb4ffc2c1
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue