procmail
[Top] [All Lists]

Re: Y2K problem in auto-responder

2000-01-03 16:35:07
On Mon, 3 Jan 2000 17:46:26 -0500,
Adam Shostack <adam(_at_)zeroknowledge(_dot_)com> wrote:
On Mon, Jan 03, 2000 at 11:26:50PM +0100, Helmut wrote:
We can't replace the (old) Smail by now. We wonder, however, if
there might be a solution using a better procmail recipe which feeds
the correct date to Smail
Can you get smail to not insert a Date: header?
If so, you can use formail -A "Date: `date`" to insert a better
date header. There's probably a variable that contains the date as
well, to save the forking.

Actually, there isn't, if you mean a variable in Procmail. And the
date on the From_ line on the incoming message might be wrong if it
was put there by Smail; otherwise, you could copy that (and hope it's
not too inaccurate -- it will be roughly the time when the incoming
message arrived on your computer).

And actually, Smail probably inserts a Date: header only if one isn't
present, so running the formail trick to add it before Smail gets to
see the message is probably the way to go. If you use an external call
to date(1), make sure you use an appropriate format string -- the
default output by date(1) is not at all what RFC1123 requires.

:0 h c
* !^FROM_DAEMON
* !^X-Loop: our(_at_)address
| (formail -r -I"Precedence: junk" \
         -A"X-Loop: our(_at_)address" ; \
   cat $HOME/received.msg) | $SENDMAIL -t

So you could replace this with

    :0hc  # %Z outputs a string on my system, replace with $TZ or something?
    * ! ^FROM_DAEMON
    * ! ^X-Loop: our(_at_)address
    | ( formail -r -I "Precedence: junk" \
                -A "X-Loop: our(_at_)address" \
                -I "`date '+Date: %d %b %Y %T %Z'`" ; \
        cat $HOME/received.msg ) | $SENDMAIL $SENDMAILFLAGS -t

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>

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition