in reply to Email STDIN
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:
for example.$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); }
--
$Stalag99{"URL"}="http://stalag99.keenspace.com";
|
|---|