This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jribbens
Recipients barry, jribbens, r.david.murray
Date 2017-04-10.20:26:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491855981.65.0.00197162829519.issue30032@psf.upfronthosting.co.za>
In-reply-to
Content
So on further investigation, with the new API and policy=SMTP, it does generate correct base64 output. So I guess on the basis that the new version can generate the right output, and it appears to be a deliberate choice that the default policy breaks the RFCs, you can close this issue ;-)

>>> from email.message import EmailMessage
>>> from email.policy import SMTP
>>> import base64
>>> msg = EmailMessage(policy=SMTP)
>>> msg.set_content("hello\nthere", cte="base64")
>>> msg.as_string()
'Content-Type: text/plain; charset="utf-8"\r\nContent-Transfer-Encoding: base64\r\nMIME-Version: 1.0\r\n\r\naGVsbG8NCnRoZXJlDQo=\r\n'
>>> base64.b64decode("aGVsbG8NCnRoZXJlDQo=")
b'hello\r\nthere\r\n'
History
Date User Action Args
2017-04-10 20:26:21jribbenssetrecipients: + jribbens, barry, r.david.murray
2017-04-10 20:26:21jribbenssetmessageid: <1491855981.65.0.00197162829519.issue30032@psf.upfronthosting.co.za>
2017-04-10 20:26:21jribbenslinkissue30032 messages
2017-04-10 20:26:21jribbenscreate