allow multipart messages to specify content-transfer-encoding on body and html payloads #29

Closed
mmerickel opened this Issue Jan 24, 2013 · 3 comments

Comments

Projects
None yet
3 participants
Owner

mmerickel commented Jan 24, 2013

Currently it's possible to specify the Content-Transfer-Encoding on an attachment, but the body and html keys are left alone. These keys are then simply forwarded on to an email.Message object. Without being able to specify your own encoding on the keys, the Python stdlib email package will base-64 encode the body or the html if it found to require a utf-8 charset. It would be nice if this were overridable such that the body or html were encoded using quoted-printable.

One possibility would be to allow the body and html keys to accept an Attachment object.

Crappy spam filters may score the message down because it doesn't know how to deal with the content.

Does anyone have thoughts on this issue?

rkintzi commented Mar 12, 2013

You can add following snippet to your __init__.py:

from email import charset
charset.add_charset('utf-8', charset.SHORTEST, charset.QP, 'utf-8')
charset.add_charset('utf8', charset.SHORTEST, charset.QP, 'utf8')
Contributor

rpatterson commented Mar 19, 2013

When I try this with a latin-1 character in both the text/plain and text/html parts, it does get encoded quoted printable, see this repoze.sendmail commit: repoze/repoze.sendmail@96c11cf. I also tried this from pyramid_mailer and it also got quoted printable encoded when sent via SMTP. Can you provide a test case?

Contributor

rpatterson commented Mar 19, 2013

@mmerickel clarified that this is only happening with utf-8 and I was only testing with latin-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment