'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
Post a Comment