#29830: EmailMessage does not respect body encoding
-------------------------------------+-------------------------------------
     Reporter:  jannschu             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Uncategorized        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  email, mail,         |             Triage Stage:
  encoding                           |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by jannschu:

Old description:

> 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.

New description:

 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#comment:1>
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/066.2e85af69226a87bb5783c146cbce9103%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to