[Python] Python and parsing email

Rob Hudson rob at euglug.net
Tue 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


More information about the Python mailing list