mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #4910 -- Allow Unicode content to be passed in for text-based e-mail
attachments. Thanks, djoume@taket.org. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
35ce8a2a8a
commit
1777e74d2a
@ -287,7 +287,8 @@ class EmailMessage(object):
|
|||||||
mimetype = DEFAULT_ATTACHMENT_MIME_TYPE
|
mimetype = DEFAULT_ATTACHMENT_MIME_TYPE
|
||||||
basetype, subtype = mimetype.split('/', 1)
|
basetype, subtype = mimetype.split('/', 1)
|
||||||
if basetype == 'text':
|
if basetype == 'text':
|
||||||
attachment = SafeMIMEText(content, subtype, settings.DEFAULT_CHARSET)
|
attachment = SafeMIMEText(smart_str(content,
|
||||||
|
settings.DEFAULT_CHARSET), subtype, settings.DEFAULT_CHARSET)
|
||||||
else:
|
else:
|
||||||
# Encode non-text attachments with base64.
|
# Encode non-text attachments with base64.
|
||||||
attachment = MIMEBase(basetype, subtype)
|
attachment = MIMEBase(basetype, subtype)
|
||||||
|
Loading…
Reference in New Issue
Block a user