Opened 6 years ago
Last modified 6 years ago
#29830 closed Bug
EmailMessage does not respect body encoding — at Version 1
Reported by: | Jannik Schürg | Owned by: | nobody |
---|---|---|---|
Component: | Core (Mail) | Version: | dev |
Severity: | Normal | Keywords: | email, mail, encoding |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I want to change the body encoding (base64, quoted-printible) of an email. Example code:
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.
Change History (2)
by , 6 years ago
Attachment: | patch.diff added |
---|
comment:1 by , 6 years ago
Description: | modified (diff) |
---|