Author calimeroteknik
Recipients barry, calimeroteknik, r.david.murray
Date 2017-10-22.00:48:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508633293.0.0.213398074469.issue31831@psf.upfronthosting.co.za>
In-reply-to
Content
Eventually there is no bug, I was just confused at the output of print() on the EmailMessage.

I noticed that in email/_header_value_parser.py policy.utf8 was True.
The reason is found in email/message.py line 970 (class MIMEPart):

    def __str__(self):
       	return self.as_string(policy=self.policy.clone(utf8=True)

print() will use __str__() and this is why it happens.

I didn't dig out the exact reason since there are so many delegated calls.
In any case, the flattened message in smtplib.SMTP does contain what as_string() returns, which means that the policy.utf8 is only forced when using print().

Sorry for the false alert.
I can guess that the intention in forcing policy.utf8=True in __str__() was that SMTPUTF8 output is visually prettier than any ASCII-armored text.

After additional fuzzing, checking the output with EmailMessage.as_string(), everything seems OK.

That's a +1 for gh-3488, which fixes this bug.
History
Date User Action Args
2017-10-22 00:48:13calimerotekniksetrecipients: + calimeroteknik, barry, r.david.murray
2017-10-22 00:48:13calimerotekniksetmessageid: <1508633293.0.0.213398074469.issue31831@psf.upfronthosting.co.za>
2017-10-22 00:48:12calimerotekniklinkissue31831 messages
2017-10-22 00:48:11calimeroteknikcreate