Handling Incoming Mailby Ian the Terrible (Beadle)
|on Dec 11, 2001 at 10:38 UTC||Need Help??|
Ian the Terrible has asked for the
wisdom of the Perl Monks concerning the following question:
When I first learned that sendmail could pipe incoming messages to a program, a number of interesting possibilities occurred to me. One that I'm especially interested in exploring is the idea of stuffing messages from a mailing list into a database, thus giving me ways to search by sender, subject, full-text...
So as a first step, I whopped up a simple script that just prints STDIN to a temp file, so I could see exactly what was coming in and get a handle on how to parse it.
This led to exploration of MIME types, base64 encoding, and various other things.
My question: Is this a reasonable way to be doing this, or would it be easier (from the standpoint of processing the mail) to let the mail flow into a mailbox, and then parse it from there?
One way gives real time processing; the other would obviously have to be a periodic cron job.
I poked around briefly on CPAN, and was overwhelmed by the sheer number of modules that deal with email in one fashion or another. Anybody got favorites?