[python-win32] help with parsing email

Tim Golden mail at timgolden.me.uk
Thu Aug 14 18:19:42 CEST 2008


Ahmed, Shakir wrote:
> 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/080612-21_test_337683.pdf 

> 
> I need to extract 080612-21 _ number from above line from incoming emails.
> 

You're underspecifying this a bit. Are you asking for
help with reading emails? Or with finding a number in
a load of text?


The answer to the first is: use COM to automate Outlook/CDO.

The answer to the second is probably to use a simple regex.
Unless the format is so simply specified that you can
just use split () and string slicing.

TJG


More information about the python-win32 mailing list