procmail
[Top] [All Lists]

Re: auto reply recipe

1996-07-10 01:30:11
Marc David Bumble writes on 9 July 1996 at 22:55:48
recipes have :0 instead of :# where # is some number.  My formula

a eaiser-to-use syntax that was added quite some time ago.  Start
every line with "* " and use :0 - you don't have to count the
conditions.

      :1 h c
      ^Subject:.*treply
      | ($FORMAIL -rk  -p ">  " -I "X-Replier: Automated response" \
              -i "From: bumble(_at_)cse(_dot_)psu(_dot_)edu" \
              -i "Subject:automated response test"; \
              cat $HOME/Mail/reply; \
              echo " "; \
              cat $HOME/.signature) | $SENDMAIL -t

assuming your current condtion of "^Subject:.*treply" is just for
testing, you probably want to make some changes before putting this
into produciton use.
   * There is little reason to quote the entire mail message back,
     this will just waste bandwidth; if you really want to 
     quote something back, limit it to just the headers which will be
     sufficient for diagnosing any mail problems.
   * you also don't want to even try to send a auto-repsonse back to
     other programs or mailer daemons, this is a good way to start a mail
     loop.
   * also, if you're doing email correspondence with someone, you
     don't need an auto-reponse message every time.

That said, you could do something along the lines of
-----
# a name that should be unique throughout the entire Internet, since
# our FQDN is unique and user names are unique within our domain.
# Could tack on some random string too. This is primarily used for
# generating X-Loop: headers.
FQDN=eu.bristol.com
UNIQUE_NAME="<${LOGNAME}(_at_)${FQDN}>"

# all the different ways I can get mail - this is before the '@'
ME_REGEXP=(dan|DanS|Dan\.Smith|dan_smith|dsmith|j_daniel_smith|J\.Daniel\.Smith)

# subject lines from other vacation programs
VACA_SUBJECT="^Subject: .*(\[(ack(nowledge?ment)?|on vacation)\]|\
auto(matic)[- ]reply|away from mail|out of town|can ?not (reply|answer)|\
(on |via )vacation( program)?)"

#####
##### an automatic reply
#####    - sent to me (ignore mailing lists/aliases)
#####    - skip program mailers
#####    - skip low priority mail
#####    - prevent loops 
#####    - In-Reply-To/References: in case someone replies to
#####      something I posted to a mailing list (add Newsgroups:?)
#####    - Be nice and look for a "reply" Subject: too (but NOT a FWD:
#####      subject - people need to learn to "reply" and not "forward"
#####      responses) 
#####
:0c
* $^TO${ME_REGEXP}
* !^FROM_DAEMON
* !^Precedence: ?(bulk|list|junk)
* $!^X-Loop: ${UNIQUE_NAME}
* !^(In-Reply-To|References|Subject: ?Re(\[[0-9]+\]])?):
* $!${VACA_SUBJECT}
{
  :0f
  | formail -rt -I "Precedence: junk" -A "X-Loop: ${UNIQUE_NAME}" \
                -I "X-Replier: Automated Response" \
                -I "Subject: automated response test"

  :0bf
  | (cat ${HOME}/Mail/reply ;\
  echo "" ;\
  cat ${HOME}/.signature )

  :0
  ! -oi -t
 }
-----

   Dan
------------------- message is author's opinion only ------------------
J. Daniel Smith <DanS(_at_)bristol(_dot_)com>        http://www.bristol.com/~dan
Bristol Technology B.V.                   +31 33 450 50 50, ...51 (FAX)
Amersfoort, the Netherlands               {info,jobs}(_at_)bristol(_dot_)com

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