Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Email STDIN

by strredwolf (Chaplain)
on Oct 12, 2001 at 11:07 UTC ( [id://118420]=note: print w/replies, xml ) Need Help??


in reply to Email STDIN

Now, even though I haven't used MIME::*, here's my thoughts which can help:

First, read RFC 2822. (It used to be 822, but they updated the spec). You'll realize that each header can wrap around to another line, and it causes havoc!!!!

Second, use procmail to do some unmunging. Procmail can fix those headers so Perl can make it eazier for you. Here's what I have in a .procmailrc:

PIDFILE=bt-rbl.$$ :0 * ? e-mail_script.pl $PIDFILE { MESS=`cat $PIDFILE` JUNK=`rm $PIDFILE` :0 /dev/null } JUNK=`rm $PIDFILE`

And for the Perl:

$flag=0; open(OUT,">$ARGV[0]") || die "Can't open conduit: $!"; while(<STDIN>) { $l=$_; chomp; $flag++ if(/^$/); # Header/Body seperation $header[$hi++]=$_ unless($flag); $body[$bi++]=$_ if($flag); }
for example.

--
$Stalag99{"URL"}="http://stalag99.keenspace.com";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://118420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found