Thank you for your reply.  I suppose I should have been a bit more specific.
 
I have indeed been using Mail::POP3Client.  However, it's the dates that I
think could prove tricky.  The code down below does indeed narrow down to
the date (assuming I work with the "Date:" header).  Dates appear to be in
"DD MMM YYYY" format (e.g. 24 Mar 2010). But will that apply regardless of
the sender's local language settings?  RFC822 seems to point to an
English-based month in the date syntax, but is that always be the case?
 
If I use the first "Received:" header entry (likely more reliable for my
purposes) it's trickier because the datestamp generally won't appear until
the next line (the "Received:" header appears to almost always be stored on
two separate lines).  As in. . .
 
##################################################################
>From <aadvant...@aadvantage.info.aa.com> Mon Mar 01 14:40:24 2010
Received: from transit120.info.aa.com [64.73.138.120] by coservers.net
  (SMTPD32-8.15) id A6005870134; Mon, 01 Mar 2010 14:40:00 -0400
To: p...@coservers.net
Message-Id: <20060501133309.a56b.2778496-52...@aadvantage.info.aa.com>
##################################################################
 
I can imagine writing code to handle parsing the Received header under this
scenario, but it seems like the module should be able to do this for me.
 
Cheers,
Paul ----
 
 
 
 
$pop = new Mail::POP3Client(
  USER     => "$Settings{username}",
  PASSWORD => "$Settings{password}",
  HOST     => "$Settings{hostname}"
);
      
for ($i = 1; $i <= $pop->Count(); $i++) {
  print "Message $1: *************************\n";
  my $headerid = 1;
  foreach ( $pop->Head( $i ) ) {
    if ($_ =~ /^Date:.*([0-9]{1,2}\s[a-zA-Z]{3}\s[0-9]{2,4})/) {
      print "$headerid: $1\n";
    }
    # /^(From|Subject):\s+/i and 
    $headerid++;
  }
  print "\n";
}
 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to