On 22/05/25, Rich Kulawiec (r...@gsp.org) wrote:
> On Fri, May 16, 2025 at 05:26:25PM -0400, Kurt Hackenberg wrote:
> > Nope, sorry. RFC 4155 has a problem. Its default format, the only one it
> > defines, defines the From_ line rigidly, forbids ">From " escaping, and does
> > not use a length. It says messages should be found by recognizing the whole
> > From_ line, with exact syntax.
...

> I agree that this is a problem.  But I don't agree with the (elided for
> brevity) suggestion that we should collectively ignore the RFC, 
...
> And then someone(s) will need to look at formail(1), grepmail(1), and
> other mail tools to try to figure out what works/breaks with what.
> I'm already staring at grepmail for other reasons, so I'll make a note
> to circle back to this issue.

Possibly off-topic, but I think grepmail uses Mail::Mbox::MessageParser, at
least for the message parsing if not the "From" escaping.

https://metacpan.org/pod/Mail::Mbox::MessageParser

This uses Config.pm which defines the start of a message as:

  'from_pattern' => q/(?mx)^
    (From\s
      # Skip names, months, days
      (?> [^:\n]+ )
      # Match time
      (?: :\d\d){1,2}
      # Match time zone (EST), hour shift (+0500), and-or year
      (?: \s+ (?: [A-Z]{2,6} | [+-]?\d{4} ) ){1,3}
      # smail compatibility
      (\sremote\sfrom\s.*)?
    )/,

See 
https://metacpan.org/release/DCOPPIT/Mail-Mbox-MessageParser-1.5111/source/lib/Mail/Mbox/MessageParser/Config.pm#L25

sub _read_rest_of_email in Perl.pm looks pretty gnarly.

Is grepmail considered a reference tool?

Reply via email to