'To' field when parsing email in Python -


i'm using python standard library's email module parse email. allows me determine sender:

msg = email.message_from_string(data) sender = msg.get_unixfrom() 

but i'm having trouble determining mail for.

thoughts?

you can access headers of message by index, e.g. msg["from"]. in case of recipient, use msg.get_all("to") because there might multiple values.

also note following:

headers stored , returned in case-preserving form matched case-insensitively.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -