The modules I found with the previous CPAN search give me the impression of doing "kinda too much" and I'm slightly loss.

I think you might be on to something there. The standard unix mailbox file format is pretty simple, you might not want to load up with a heavy mail processing module at all.

A single mail message consists of headers, a blank line, and the body. Mailbox files separate these with lines that begin "From " - case sensitive. So you can write up code that looks for:

/^From / and ... # New message, next line begins the headers /^$/ and ... # Blank line, next line begins the body
Interesting bit of trivia - most mail transfer agents will prefix any line in a mail message that they process that beings "From " with a ">", like a citation, so that this:

From Tuesday on, I'll be on vacation.
becomes this:

>From Tuesday on, I'll be on vacation.
...just to keep that mail message from screwing up the mailbox format when it gets delivered somewhere.

Anyway, if you're not too concerned about parsing MIME structures but just want something closer to a straight grep, taking apart the mailbox file by hand isn't very heavy lifting at all.


In reply to Re: How to filter a *NIX Mailbox by McD
in thread How to filter a *NIX Mailbox by blazar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.