* David A Golden (david@xxxxxxxxxxxxxx) [030422 00:40]:
> Mail::Message->read() doesn't like being passed an Mbox-style line with the
> opening "From ". My guess is that the parser is expecting a "From:" line
> and then fails when it doesn't see a colon until it hits the timestamp.
As Greg already mentions: this has been discussed before. But to replay
my argumentation in brief:
Mail::Message->read litterally means that it only reads a
Mail::Message, nothing else!
Mail::Box::Mbox::Message->read
would be more appropiate, but... it expects
the message to be part of a folder, which is
not true in this case.
> [Mark -- could we get explicit clarification of how read() works into the
> docs to avoid this? ...]
I have added this to the documentation:
Some people use this method in a procmail script: the message arrives
at stdin, so we only have a filehandle. In this case, you are stuck
with this method. The message is preceeded by a line which can be
used as message separator in mbox folders. See the example how to
handle that one.
# promail example
my $fromline = <STDIN>;
my $msg = Mail::Message->read(\*STDIN);
my $coerced = $mboxfolder->addMessage($msg);
$coerced->fromLines($fromline);
Which gives you some answers as well.
> <>;
^^^ this is not always the same as <STDIN>
> my $orig = Mail::Message->read(\*STDIN);
> $bb->tagmsg( { 'msg'=>$orig, 'threshold'=>0.9,
> 'header'=>"X-Mail-Classifier"});
> my $msg = Mail::Box::Mbox::Message->coerce($orig);
> $msg->write;
Doesn't help you
>>1. the weird space inserted in the "From " line
In Mail::Message::Head::Complete, the method createFromLine() is called
to produce a new line.
"From $sender ".(gmtime $stamp)."\n";
It looks as if your gmtime is doing strange things :( Stamp is a
numeric.
> >2. my additional header
> >$bb->tagmsg( { 'msg'=>$msg, 'threshold'=>0.9,
> >'header'=>"X-Mail- Classifier"});
> >+X-Mail-Classifier: HAM
The fields are beautified: blanks in field names are not permitted. Some
clients do produce them, and therefore some applications break: Mail::Box
removes them to help applications processing them.
> >3. deletion of the trailing space (?!?)
> >-
You mean trailer blank lines?
If they are not included in the Lines count (or that field does not
exist), they are removed. Most MTAs/MUAs do that, I think, especially
because mbox-folder tend to mess those line up....
--
MarkOv %-]
------------------------------------------------------------------------
drs Mark A.C.J. Overmeer MARKOV Solutions
Mark@xxxxxxxxxxxx solutions@xxxxxxxxxxxx
http://Mark.Overmeer.net http://solutions.overmeer.net
|