help with parsing email

Maric Michaud maric at aristote.info
Mon Aug 18 07:52:11 EDT 2008


Le Monday 18 August 2008 12:43:02 Gabriel Genellina, vous avez écrit :
> En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir <shahmed at sfwmd.gov> 
escribió:
> > I need to grab/parse numeric numbers such as app number from incoming
> > emails stored in Microsoft Outlook (Microsoft Exchange server) with
> > specified subject line.
> >
> > The email body is like this
> >
> > myregion ; tst ; 11-Aug-2008
> >
> > http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/0
> >80612-21_test_337683.pdf
> >
> > I need to extract 080612-21_ number from above line from incoming
> > emails.
>
> I can't help with the part dealing with Outlook - but once you retrieved
> the email body, it's easy:

Three options here :

- dealing directly with outlook mailboxes files, I used some open source code 
to parse .pst files in past, but you'll need some googling to match your 
requirements. Doesn't help if there is an instance of outlook running on the 
box.

- use the outlook COM or even some windows MAPI interface via WIN32 API 
(pywin32), can't help with this one.

- access emails directly on the Exchange server via standard python modules 
poplib or imaplib, my preferred choice if one of these protocols are 
supported by your environment. You won't need no extensions, just a standard 
python installation, and your code will work with most mail delivery agent 
and will run on all python supported platform.

-- 
_____________

Maric Michaud




More information about the Python-list mailing list