Author _savage
Recipients _savage, barry, maciej.szulik, python-dev, r.david.murray
Date 2018-07-31.12:21:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I was about to open an issue when I found this one.

Consider an email message with the following:

message = EmailMessage()
message["From"] = Address(addr_spec="", display_name="Jens Troeger")
message["To"] = Address(addr_spec="", display_name="Martín Córdoba")

It’s important here that the email itself is `ascii` encodable, but the names are not. With that combination, send_message() falsely assumes plain text addresses (see where it checks only email addresses, not display names!) and therefore the `international` flag stays False.

As a result of that, flattening the email object ( incorrectly inserts multiple linefeeds, thus breaking the email header, thus mangling the entire email:

flatmsg: b'From: Jens Troeger <>\r\nTo: Fernando =?utf-8?q?Mart=C3=ADn_C=C3=B3rdoba?= <>\r\r\r\r\r\nSubject:\r\n Confirmation: …\r\n…'

I think a proper fix would be in line 949, where email addresses and display names should be checked for encoding.

The comment to that function should also be adjusted to mention display names?

Note also that the attached patch does not test the above scenario, and should probably be extended as well.
Date User Action Args
2018-07-31 12:21:42_savagesetrecipients: + _savage, barry, r.david.murray, python-dev, maciej.szulik
2018-07-31 12:21:42_savagesetmessageid: <>
2018-07-31 12:21:42_savagelinkissue24218 messages
2018-07-31 12:21:42_savagecreate