#29830: EmailMessage does not respect body encoding
-------------------------------------+-------------------------------------
Reporter: jannschu | Owner: nobody
Type: New | Status: new
feature |
Component: | Version: master
Uncategorized | Keywords: email, mail,
Severity: Normal | encoding
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I want to change the body encoding (base64, quoted-printible) of an email.
Example code:
{{{
#!python
from email import charset
from django.core.mail import EmailMessage
msg = EmailMessage("Subject", "Hello World")
encoding = charset.Charset("utf--8")
encoding.body_encoding = charset.QP
msg.encoding = encoding
print(msg) # Is not encoded with quoted-printables
}}}
The quoted-printible encoding in this case is overwritten in
`SafeMIMEText`. The `encoding` property of `EmailMessage` seems not to be
documented? I attached a patch which changes the bahvior of SafeMIMEText
for the case a `email.charset.Charset` object was given.
Another idea is to add a new property to `EmailMessage.__init__` which
allows to set the body encoding.
Versions 1.11 through master are affected.
--
Ticket URL: <https://code.djangoproject.com/ticket/29830>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.fb026941a5cece19b646ffe671f46b8f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.