parsing long `To' and 'Cc' from email

Steve Holden steve at holdenweb.com
Thu Sep 6 16:49:51 EDT 2007


Gerardo Herzig wrote:
> Hi all. Im trying to develop yet another email filter. Just for fun for 
> now. Im having a little trouble parsing long 'To' and 'Cc' headers. 
> Sometimes p.e. the 'To' header comes like
> 
> 'account1 at site.com, account at site2.com'
> others comes like
> '"My self" <my.account at self.net>, "My brother" <brother.account at self.net>',
> other times a \r\t comes inside the `To' header. And any combination of 
> the above mentioned (and shurely more) can ocur.
> 
> the email.* package dont seems to parse that kind of headers 
> `correctly'. What i want is to get a list with all the email address in 
> the `To' header.
> 
> Someone know if there is a more sofisticated parser for doing this?
> 
Have you tried using email.utils.getaddresses()?

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list