procmail
[Top] [All Lists]

Re: Date: vs. Received:

1998-04-13 13:23:52
On Mon, 13 Apr 1998 15:15:47 -0400, Vikas Agnihotri <VikasA(_at_)att(_dot_)com>
wrote:
I was wondering: Since the first Received: header in the message
(deepest in the headers) indicates contains the time that the
message was handed off to the initial MTA, this is a pretty good
approximation to what the Date: header "should" be. And, IMO, a MTA
is much much less likely to be mis-configured than a MUA and so the
date present in this header is pretty accurate.
That said, and assuming a "default" Received: header format, how can I
stuff this date into Date: header? Lots of parsing involved, eh?

Assuming you are assuming the default to be something like the
Sendmail rwth-aachen.de seems to be using, try this:

    :0
    * ^Date:.*\<19(70|95)\>
    {
        :0fhw # This has a Year 3000 Problem, cope with it :-)
        * 1^1 ^Received:.*\/[A-Z][a-z][a-z], [ 0-1][0-9] \
                    [A-Z][a-z][a-z] [1-2][0-9][0-9][0-9].*
        | formail -i "Date: $MATCH"
    }

For the message I'm replying to here, the scoring part produces

procmail: Matched "Mon, 13 Apr 1998 22:36:49 +0300 (EET DST)"
procmail: Matched "Mon, 13 Apr 1998 21:36:46 +0200 (MET DST)"
procmail: Score:       2       2 "^Received:.*\/[A-Z][a-z][a-z], [ 0-1][0-9] 
[A-Z][a-z][a-z] [1-2][0-9][0-9][0-9].*"
procmail: Executing "formail,-i,Date: Mon, 13 Apr 1998 21:36:46 +0200 (MET DST)"

The Procmail list server is a bit slow, as we all know, so the produced
timestamp is not very accurate.

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

<Prev in Thread] Current Thread [Next in Thread>