summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.11.txt4
-rw-r--r--docs/topics/email.txt13
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt
index a23d5f3663..46c780eda8 100644
--- a/docs/releases/1.11.txt
+++ b/docs/releases/1.11.txt
@@ -162,6 +162,10 @@ Email
* Added the :setting:`EMAIL_USE_LOCALTIME` setting to allow sending SMTP date
headers in the local time zone rather than in UTC.
+* ``EmailMessage.attach()`` and ``attach_file()`` now fall back to MIME type
+ ``application/octet-stream`` when binary content that can't be decoded as
+ UTF-8 is specified for a ``text/*`` attachment.
+
File Storage
~~~~~~~~~~~~
diff --git a/docs/topics/email.txt b/docs/topics/email.txt
index 2b880e0ba9..7c8f5e6112 100644
--- a/docs/topics/email.txt
+++ b/docs/topics/email.txt
@@ -345,6 +345,11 @@ The class has the following methods:
If you specify a ``mimetype`` of ``message/rfc822``, it will also accept
:class:`django.core.mail.EmailMessage` and :py:class:`email.message.Message`.
+ For a ``mimetype`` starting with ``text/``, content is expected to be a
+ string. Binary data will be decoded using UTF-8, and if that fails, the
+ MIME type will be changed to ``application/octet-stream`` and the data will
+ be attached unchanged.
+
In addition, ``message/rfc822`` attachments will no longer be
base64-encoded in violation of :rfc:`2046#section-5.2.1`, which can cause
issues with displaying the attachments in `Evolution`__ and `Thunderbird`__.
@@ -359,6 +364,14 @@ The class has the following methods:
message.attach_file('/images/weather_map.png')
+ For MIME types starting with ``text/``, binary data is handled as in
+ ``attach()``.
+
+.. versionchanged:: 1.11
+
+ Added the fallback to MIME type ``application/octet-stream`` when binary
+ data for a ``text/*`` attachment cannot be decoded.
+
Sending alternative content types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~