Help on Email Parsing

John Roth newsgroups at jhrothjr.com
Mon Feb 23 11:12:14 EST 2004


"dont bother" <dontbotherworld at yahoo.com> wrote in message
news:mailman.190.1077526040.27104.python-list at python.org...
> Hey,
> I have been trying to parse emails:
> But I could not find any examples or snippets of
> parsing emails in python from the documentation.
> Google did not help me much too.
> I am trying to understand the module 'email' and the
> functions described there to parse email but seems
> difficult.
> Can anyone help me in locating some pointers or
> snippets on this issue.
> Thanks a Ton
> Dont

You may want to study the MIME format a
bit first. It's not a particularly simple format.

The final example in the email documentation
seems to be fairly straightforward. The line:

msg = email.message_from_file(fp)

does everything and leaves the result in
memory as objects.

Of course, this is the *new* email package
that is in 2.2.3 and later. I don't believe the
old one was particularly easy to work with.

John Roth

.
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail SpamGuard - Read only the mail you want.
> http://antispam.yahoo.com/tools
>





More information about the Python-list mailing list