logo       

Re: challenged by a "From " line issue: msg#00082

Subject: Re: challenged by a "From " line issue
* 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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe