[Tutor] Working with Email question

Sheila King sheila@thinkspot.net
Sat, 23 Feb 2002 13:13:27 -0800

On Sat, 23 Feb 2002 15:47:40 -0500, "Joel Ricker"
<joejava@dragoncat.net>  wrote about [Tutor] Working with Email

> I've got a little script going that does a good job as connecting to a
> POP3 server and query for messages and the sort.  What I need now is
> the ability to dissect those messages for spam.  Digging around I
> found the libraries for working with MIME data that seems to be
> related to working with email but they seem to be more for working
> with MIME files (building up files rather that analyzing already
> created emails).  Is there a library already for working with
> messages?  Something like given the text of a message, you can easily
> extract the body, to: lines, etc, or am I'm going to have to write one
> myself?  Just wanted to check before I re-invent anything.

It depends on whether you want to handle the attachments or work with
the attachments on the email. If all you want to do, is filter on the
message headers, then the rfc822 library will be sufficient. If,
however, you want to deal with the attachments, you will probably want
to use multifile and mimetools.

Python 2.2 has a new email module included, which looks to be very nice,
but I've been working with it, and:
(1) It is not well documented (at least, not from a beginner's point of
(2) It is somewhat buggy IMO. For solid performance at this point, I'd
recommend rfc822 and if needed, multifile and mimetools.

Sheila King

"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_