[ale] Easy way to cut body of email in perl
attriel
attriel at d20boards.net
Thu Jan 5 00:17:13 EST 2006
>> I'm using procmail to pass email via STDOUT to a program that is
>> supposed to do various things based on what is in the email. I need a
>> way in perl to separate the headers from the body. Attached is a piece
>> of my log file that shows email that the system received.
> [... snip ...]
>> Should I consider everything after "Content-Transfer-Encoding" to be the
>> body?
>
> In this case, sure. In general, no since there's no guaranteed ordering
> of headers.
> Safest bet would be to use Mail::Internet or the like and let that parse
> things.
It's been a while since i was manually deconstructing mail, but IIRC
there's a blank line between headers and body ... and between messages.
Of course, then theres' all those pesky blank lines IN the message (2 so
far here :o) ... but each message should begin with the "From blah" line
... I /think/ that's how it would be passed into a filter straight off the
wire, since i think the point of mbox format was that it was trivial to
spit out ...
--attriel
More information about the Ale
mailing list