Re: Header folding
David A Golden <[email protected]> Wed, 18 Aug 2004 13:52:13 -0400
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <5.2.0.9.2.20040818133725.00b8fba8@localhost> |
At 8/18/2004 01:15 PM, Scott Grim wrote:
>It appears that the read method in Mail::Message::Construct::Read assumes
>that all header lines are already folded and makes no effort to fold them.
>Is there any (easy) way around this in the case that the header has lines
>that are, in fact, not folded?
>
>I have the entire message in a scalar variable and would like to use read to
>put it into a Mail::Message object. From there, I need to evaluate and
>sometimes modify header information (to do spam marking, etc) before
>inserting the message into a database for a database-driven mail system.
Reading from a scalar (or filehandle) should handle folded and unfolded
headers just fine in the input. Are you having problems with the input or
the folding of headers when outputting the message after you've modified
it? (Mail::Box defaults to folding headers if they exceed 78 characters.)
Can you post some example code and output that shows the problem your having?
For reference, here's how I use Mail::Box as a procmail filter for spam
tagging:
<>; # ignore the "From_" line that procmail adds
my $msg = Mail::Message->read(\*STDIN);
$bb->tagmsg( { msg=>$msg, %options } ); # A Mail::Classifier object
print $msg->head->createFromLine;
$msg->print;
Regards,
David