From eeb4ffc2c1b9baaf9f8e87d14e24b1679f98f7b7 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Wed, 27 Jun 2007 12:54:15 +0000 Subject: [PATCH] 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 --- django/core/mail.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)