procmail
[Top] [All Lists]

Re: Y2K problem in auto-responder

2000-01-04 17:25:53
Thank you for your help, it was very useful. We decided to grab the date from 
the From_ line, following Era's recipe (see below) and the receivers found the 
responses on the right place in their date sorted mailbox.

The date was not in ARPA style, however (thank you, Reto), it always had (like 
the results of our date command) the following format:
  Tue Jan 4 20:55:08 GMT 2000

So I tested the following recipe which seems to work out well:

:0 h c
* !^FROM_DAEMON
* !^X-Loop: our(_at_)address
* ^From [^ ]+  \/.+
{
  FROM_=$MATCH
  :0
  * FROM_ ?? ^^\/[a-z][a-z][a-z]
  { WEEKDAY=$MATCH } 
  :0
  * FROM_ ?? ^^... \/[a-z][a-z][a-z]
  { MONTH=$MATCH }
  :0
  * FROM_ ?? ^^... ... \/([ ][0-9]|[0-3][0-9])
  { DAY=$MATCH } 
  :0
  * FROM_ ?? ^^.+\/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]
  { TIME=$MATCH }
  :0
  * FROM_ ?? ()\/[1-2][0-9][0-9][0-9]
  { YEAR=$MATCH }
  :0
  | ( formail -r -I "Precedence: junk" \
                 -A "X-Loop: our(_at_)address" \
                 -I "Date: $WEEKDAY, $DAY $MONTH $YEAR $TIME +0100" ; \
    cat $HOME/received.msg ) | $SENDMAIL -t
}

And yes, we will update our system (NeXTStep 3.3 on Intel with Apple Y2K patch 
3) as soon as possible.
Thank you,
Helmut Brammerts

era eriksson schrieb:
or grab from the From_ line if that's more convenient:

    :0 # two spaces before \/ !
    * ! ^FROM_DAEMON
    * ! ^X-Loop: our(_at_)address
    * ^From [^ ]+  \/.+
    | ( formail -r -I "Precedence: junk" \
                -A "X-Loop: our(_at_)address" \
                -I "Date: $MATCH" ; \
        cat $HOME/received.msg ) | $SENDMAIL $SENDMAILFLAGS -t

In order to test this, you might want to change the call to Sendmail
to send to an address of yours instead of use the To: header (change
-t to your test address) or perhaps add a Bcc: to some address where
you can receive and examine the generated replies. Other ideas like
this are on <http://www.iki.fi/era/mail/procmail-debug.html>

-- PLEASE NOTE NEW TEL. AND FAX NUMBERS!
Helmut Brammerts        Helmut(_dot_)Brammerts(_at_)ruhr-uni-bochum(_dot_)de
Sprachlehrforschung     FAX:  +49 - 234 - 3214 580 /578 /138
Ruhr-Universität Bochum Tel.: +49 - 234 - 322 8748 /3815 /7502
D-44780 Bochum          http://www.slf.ruhr-uni-bochum.de/slf/brammerts
-----------------------------------------------------------------------