[Tutor] Parsing the contents of an email message.

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Wed Apr 21 14:59:55 EDT 2004

hi Jorge, I am finishing up an application that grabs emails, passes them
through a filter, and parses them.  I ended up using:

import MySQLdb, re
from imaplib import IMAP4_SSL
from email import message_from_string
from email.Utils import parsedate_tz, mktime_tz
from time import strftime, strptime, localtime, time

As you will see, dateTime is very important when parsing emails,
especially when debugging your application by writing an errorlog of
emails that didn't parse correctly.

On Wed, 21 Apr 2004, Jorge Godoy wrote:

> Hi!
> I'm working with a CVS project where I'll need to get some information from
> the report it does via an email message.
> I've been reading the "Global Module
> Index" (http://www.python.org/doc/current/modindex.html) looking for tools
> to parse the body of such a message.
> I'm planning on having such messages delivered locally to a file, so I can
> use some method to make that file the message, without having to setup a
> POP/IMAP server.
> Is email.Parser the best module for such a task?

More information about the Tutor mailing list