euglug.org

[Python] Python and parsing email

작성자

카테고리:



Rob HudsonTue Apr 4 15:34:11 PDT 2006

> The sender is in the main message.  So it should be like this.
> 
> 	sender = email.Utils.getaddresses(msg['From'])[0]

I didn't make it to the Utils part of the documentation.  This was 
helpful, thanks.

email.Utils.getaddresses() gave me something weird (each letter was it's 
own list item), so I used this:

	sender = email.Utils.parseaddr(msg['From'])[1]

-Rob