Open EmilStenstrom opened 10 years ago
The problem is on properly_encode_header
. email.parseaddr
just parses and returns the first address if there are more than one. Fix is to split the address on "," and then use email.getaddresses
instead. Pull request on the way.
After this fix, the test case I gave above works fine:
>>> msg2 = email.message_from_string("To: =?utf-8?q?Emil_Stenstr=C3=B6m?= <person1@domain.com>, Person2\n\t<person2@domain.com>")
>>> print encoding.to_message(encoding.from_message(msg2))
From nobody Tue Dec 3 13:52:03 2013
MIME-Version: 1.0
To: "=?utf-8?q?Emil_Stenstr=C3=B6m?=" <person1@domain.com>,
"=?utf-8?q?Person2?=" <person2@domain.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
@zedshaw Any chance to get this merged so I can stop using my own fork?
Probably not. Look around, you'll see Zed abandoned this project. Please use https://github.com/moggers87/salmon/ as it is the best maintained fork
Note that the from_message step seems to work fine: