[Tutor] Working with Email question
Sat, 23 Feb 2002 14:18:28 -0800
On Sat, 23 Feb 2002 16:36:38 -0500, "Joel Ricker"
<firstname.lastname@example.org> wrote about Re: [Tutor] Working with Email
> So if I'm following the documentation correctly, I'll need to save each
> message to a local file since all of those mentioned use a file pointer.
> Then use rfc822 to load in my header and look for any content boundaries.
> Use those boundaries to load each piece of the body in using Multifile, if
> no boundaries, just load the whole body. Is that right?
Well, I don't know if you have to save them to a local file or not.
rfc822 will read from stdin (and actually, anything that will read from
a file can be made to read from stdin). The mail filters I've read
reside on my web host, who hosts my email addresses, and whenever an
incoming email message arrives, I have my filters invoked by .qmail
(they use Qmail as a Mail Transfer Agent). It sounds like you are trying
to retrieve the mail via pop and then filter it. I've not worked with
the poplib, but I would assume you could read the messages straight from
stdin as the poplib is retrieving them, into an instance of rfc822.
If you use rfc822, you have to read in the body separately (rfc822 only
reads in the headers).
Then you will have to look for the content boundaries or just load the
whole body. Yes. When filtering for banned words, you will encounter
other problems, such as HTML mark-up and other types of encoding (such
as quoted-printable and so on...)
"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_