[Pdx-pm] help with parsing mail

John Springer john at digitalmx.com
Sat Apr 24 10:06:02 CDT 2004


I have a little robot script that I use to send mail
to one of several lists.  I can trigger it with a command line (i.e., 
from cron)
or trigger it by sending an email to an address that's piped to
the script.  When I send an email, it parses the incoming mail,
finds a command in the  subject line and then
(depending on the command) simply
forwards the body of the email to the right list.

I'm having a terrible time getting it to handle the header and
content for multi-part messages right.  I read the incoming
mail header and try to copy the important lines to a new $Header.
After header i stick the rest of the message into $Body.
Then send out the mail using sendmail -t << eof
To: $to
From: $from
Subject: $subject
$Header

@Body

eof

But it's not reliable.  Sometimes the mime boundary doesn't get
recognized.  Sometimes the header appears to be ending in the
wrong place.  I've spent way too much time trying to make sure
I've stripped line feeds, picked up continuations in the header, etc.

Is there some module that will help me do this?


--
   John Springer
   Somewhere in Portland
   Where it's probably raining.




More information about the Pdx-pm-list mailing list