simple script to read and parse mailbox

fishboy fishboy at spamspamspam.com
Sun Jun 6 06:31:16 CEST 2004


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.

><{{{*>




More information about the Python-list mailing list