From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Paul Rogers Sent: 24 March 2010 15:17 To: perl-win32-users@listserv.ActiveState.com Subject: RE: parsing email headers
> 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. CPAN is your friend. For example, I tried <http://search.cpan.org/search?query=datetime%3A%3Aformat&mode=all>, and on the fourth page I saw DateTime::Format::Mail, which sounds pretty much like what you are asking for. BTW, it seems to be available vie ppm as well. HTH -- Brian Raven Please consider the environment before printing this email. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs