| 2 | | |
| 3 | | Replying to [comment:1 MoritzS]: |
| 4 | | > Originally, being able to have unicode in attachment file names was added in ticket #14964. |
| 5 | | > |
| 6 | | > I tested this: |
| 7 | | > |
| 8 | | > {{{ |
| 9 | | > from django.core.mail import EmailMultiAlternatives |
| 10 | | > msg = EmailMultiAlternatives('Test', 'email body\nend', 'from@example.com', ['to@example.com']) |
| 11 | | > msg.attach_alternative('<html><body>email body<br>end</body></html>', 'text/html') |
| 12 | | > msg.attach(u'fíle_with_ünicöde_çhårs', b'foobar', 'application/octet-stream') |
| 13 | | > msg.send() |
| 14 | | > }}} |
| 15 | | > |
| 16 | | > and got following email body: |
| 17 | | > |
| 18 | | > {{{ |
| 19 | | > Content-Type: multipart/mixed; boundary="===============5134186686965449755==" |
| 20 | | > MIME-Version: 1.0 |
| 21 | | > Subject: Test |
| 22 | | > From: from@example.com |
| 23 | | > To: to@example.com |
| 24 | | > Date: Wed, 17 Feb 2016 07:17:41 -0000 |
| 25 | | > Message-ID: <some_number@myhost> |
| 26 | | > |
| 27 | | > --===============5134186686965449755== |
| 28 | | > Content-Type: multipart/alternative; |
| 29 | | > boundary="===============0773237926637752706==" |
| 30 | | > MIME-Version: 1.0 |
| 31 | | > |
| 32 | | > --===============0773237926637752706== |
| 33 | | > MIME-Version: 1.0 |
| 34 | | > Content-Type: text/plain; charset="utf-8" |
| 35 | | > Content-Transfer-Encoding: 7bit |
| 36 | | > |
| 37 | | > email body |
| 38 | | > end |
| 39 | | > --===============0773237926637752706== |
| 40 | | > MIME-Version: 1.0 |
| 41 | | > Content-Type: text/html; charset="utf-8" |
| 42 | | > Content-Transfer-Encoding: 7bit |
| 43 | | > |
| 44 | | > <html><body>email body<br>end</body></html> |
| 45 | | > --===============0773237926637752706==-- |
| 46 | | > |
| 47 | | > --===============5134186686965449755== |
| 48 | | > Content-Type: application/octet-stream |
| 49 | | > MIME-Version: 1.0 |
| 50 | | > Content-Transfer-Encoding: base64 |
| 51 | | > Content-Disposition: attachment; |
| 52 | | > filename*="utf-8''f%C3%ADle_with_%C3%BCnic%C3%B6de_%C3%A7h%C3%A5rs" |
| 53 | | > |
| 54 | | > Zm9vYmFy |
| 55 | | > --===============5134186686965449755==-- |
| 56 | | > }}} |
| 57 | | > |
| 58 | | > According to [https://tools.ietf.org/html/rfc2231 RFC 2231] that is encoded correctly. My MUA also displays it correctly, so it seems to be an error with Google and Zimbra. |