simple script to read and parse mailbox

chuck amadi chuck.amadi at ntlworld.com
Sun Jun 6 12:08:40 CEST 2004


fishboy wrote:

>On Sat, 05 Jun 2004 15:27:36 +0100, chuck amadi
><chuck.amadi at ntlworld.com> wrote:
>
>  
>
>>Hi , Im trying to parse a specific users mailbox (testwwws) and output 
>>the body of the messages to a file ,that file will then be loaded into a 
>>PostGresql DB at some point .
>>
>>I  have read the email posts and been advised to use the email Module 
>>and mailbox Module.
>>
>>The blurb from a memeber of this list . Im not at work at the moment So 
>>I cant test this out , but if someone could take a look and check that 
>>im on the write track as this Monday I need to show my Boss and get the 
>>body data out of the user's mailbox.
>>
>>**Blurb form a member who's directed me**
>>
>>Thus started with the mailbox and email modules.  Mailbox lets you iterate over a 
>>mailbox yielding individual messages of type email.  The e-mail object lets 
>>you parse and operate on the message components.  From there you should be 
>>able to extract your data.
>>
>>    
>>
>
>Hi again Chuck,
>
>I've been reading a few of your posts and I'm wondering.  Are the
>emails that you're parsing have binary attachments, like pictures and
>stuff, or are you just trying to get the text of the body?
>
>Or is it a little of both?  It looks like you're expecting emails with
>multiple binary attachments.
>
>Other than that it looks good.  You can access the header fields
>directly, like:
>
>print msg['From']
>
>Save you a little typing.
>
>  
>
>><{{{*>
>>    
>>
>
>  
>
Just Trying to get the body of the messages .

I have built and developed a dtml zope web form that encapsulate the 
survey data.
Thus the created user testwwws mail box with have the results that I 
must parse and process to a file that I can then use to populate a 
database .

Cheers Chuck





More information about the Python-list mailing list