Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2007 -- Added support for configurable encoding of email messa…

…ge bodies.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit eeb4ffc2c1b9baaf9f8e87d14e24b1679f98f7b7 1 parent 26659f2
@malcolmt malcolmt authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/core/mail.py
View
4 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 @@ def get_connection(self, fail_silently=False):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.