Message288720
email.Message class has method get_params() that can decode(unquote) header values in compliance with RFC2231 and RFC2047. But if in email message exists multiple headers with the same key it can't be used to decode other headers than first.
In my application I could use:
headers = message.items()
for key, value in headers:
cleanValue = message.get_params(value=value)
print(key, cleanValue)
Also have posted question on stackoverflow:
http://stackoverflow.com/questions/42502312/python-3-email-package-how-decode-given-header-value |
|
Date |
User |
Action |
Args |
2017-02-28 18:32:28 | pi314159 | set | recipients:
+ pi314159, barry, r.david.murray |
2017-02-28 18:32:28 | pi314159 | set | messageid: <1488306748.36.0.996484861833.issue29678@psf.upfronthosting.co.za> |
2017-02-28 18:32:28 | pi314159 | link | issue29678 messages |
2017-02-28 18:32:28 | pi314159 | create | |
|