I've successfully configured
fetchmail and I'm able to download messages from the mail server but I'm not sure how to get the date on which a particular email was received. I need this date for reporting purposes.
That date is found inside the email headers. They look a bit like this:
Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [22.214.171.124]) by mailserver.example.com (Postfix) with ESMTP id DCFEE3983D for <firstname.lastname@example.org>; Tue, 23 Jul 2013 20:32:34 +0200 (CEST) Received: by mail-pd0-f170.google.com with SMTP id x11so8452192pdj.29
Every mail server that the email passes by will add its own received-line on top of the preceding ones. Look for the one containing the host name of your mailserver and get the date from there.