Closed
Description
Bug report
When during address list folding a separating comma ends up on a folded line containing that is to be unicode-encoded than the separator itself is also unicode encoded. Instead the comma should still a plain comma.
This is rejected by some mail servers:
ZZZ: host YYY said:
550 Invalid address in message header. Consult RFC2822. (in reply to end of
DATA command)
Minimal example:
>>> import email
>>> m = email.message.EmailMessage()
>>> t = '01234567890123456789012345678901234567890123456789012345678901@example.org, ä <foo@example.org>'
>>> m['to'] = t
>>> m.as_string()
'to: 01234567890123456789012345678901234567890123456789012345678901@example.org\n =?utf-8?q?=2C?= =?utf-8?q?=C3=A4?= <foo@example.org>\n\n'
Your environment
- CPython versions tested on: 3.10.9, latest main (e47b139)
- Operating system and architecture: ArchLinux x86_64