Woops! "disparate" is should be :blush: but maybe it goes to show you the state of mind I was in when I posted the thread :-D

Well, to answer some of my own questions :

1. MIME::Parser is way too heavy for this purpose. If you have to call $parser->filer->purge(); to delete all the files created from each of the mails. This really seems too much to "just read 4 fields from an email header".

MIME::Head however seems to fit the bill very well :

my $head = MIME::Head->read( \*FILE ); # TODO : Does it read the WHOLE + email or skips the remaining mail after reading the header? $head->unfold; # Was a "Subject:" field given? # $subject_was_given = $head->count('subject'); print $head->get('subject'); print $head->get('Message-ID'); print $head->get('from'); print $head->get('date');

2. I would appreciate some answers to this.

Of course missing id's will be logged and error handling done, but I was wondering if there are any servers with such known behaviour.

3. This works just dandy :

use Date::Manip; Date_Init("ConvTZ=IGNORE","TZ=GMT"); my $date = UnixDate( $head->get('date') , '%Y_%m_%Q-%H%M%S'); print $date;

This can convert, for eg : "Sat, 9 Feb 2008 17:04:08 EET" to "2008_02_20080209-170408"

Thanks guys for the great insights! Furthur tips/tricks/etc are welcome though.


In reply to Re^2: Parsing email for headers by PoorLuzer
in thread Parsing email for headers by PoorLuzer

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.