Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored June 27, 2007

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  django/core/mail.py
4  django/core/mail.py
@@ -171,6 +171,7 @@ class EmailMessage(object):
171 171
     """
172 172
     content_subtype = 'plain'
173 173
     multipart_subtype = 'mixed'
  174
+    encoding = None     # None => use settings default
174 175
 
175 176
     def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
176 177
             connection=None, attachments=None, headers=None):
@@ -189,7 +190,8 @@ def get_connection(self, fail_silently=False):
189 190
         return self.connection
190 191
 
191 192
     def message(self):
192  
-        msg = SafeMIMEText(self.body, self.content_subtype, settings.DEFAULT_CHARSET)
  193
+        encoding = self.encoding or settings.DEFAULT_CHARSET
  194
+        msg = SafeMIMEText(self.body, self.content_subtype, encoding)
193 195
         if self.attachments:
194 196
             body_msg = msg
195 197
             msg = SafeMIMEMultipart(_subtype=self.multipart_subtype)

0 notes on commit eeb4ffc

Please sign in to comment.
Something went wrong with that request. Please try again.