Subject: Re: X-Loop?

From: [email-masked] (David W. Tamkin)
Date: Wed, 4 Jan 1995 17:05:40 -0600 (CST)

Nancy McGough asked,

| Is a reasonable alternative to put ``Precedence: bulk'' in the 
| headers and then not auto-respond to messages that have this
| header?  For example, here's what I'm using for my vacation
| auto-responder (thanks to lots of help from y'all!):

It's certainly both reasonable (and polite) to give automated responses low
precedence and not to auto-respond to incoming mail with low precedence, but
there are other times when loop detectors are still needed: for example, when
you have two addresses and forward all mail for each to the other.

| :0
| * !^FROM_DAEMON
| {
|   SUBJECT="Subject: I'm on vacation [Re:`formail -xSubject:`]"
|   FROM=`formail -rtxTo:`   
|   EXTRA_AUTOREPLY_HEADERS="$PMDIR/autoreply_headers"
|   ALREADYSENT="$PMDIR/vacation.cache"   #vacation database
| 
|   :0 hc:
|   * !? fgrep -e "$FROM" $ALREADYSENT
|   | echo "$FROM" >> $ALREADYSENT ; \
|     (( cat $EXTRA_AUTOREPLY_HEADERS ; formail -rtI"$SUBJECT") ; \
|      cat $PMDIR/vacation.msg ; \
|      echo "-- " ; \
|      cat $HOME/.signature ; \
|      ) | $SENDMAIL -oi -t
| }

I'm curious, Nancy: what does the double nesting of parentheses accomplish
for you?  It seems the inner pair really don't do anything except make the
shell copy the environment an extra time unless I'm missing something (no,
besides that).

Does formail -rtD use the -rt reply address instead of the -r reply address?
I'm not sure.  If it does, you can do this in the second recipe:

    :0 hc:
    * !? formail -rtD $ALREADYSENT
    | ( cat $EXTRA_AUTOREPLY_HEADERS ; formail -rtI"$SUBJECT" ; \
       cat $PMDIR/vacation.msg ; echo "-- " ; \
       cat $HOME/.signature ) | $SENDMAIL -oi -t

If your version of cat honors "-" between filenames, you remove one cat:

    :0 hc:
    * !? formail -rtD $ALREADYSENT
    | ( formail -rtI"$SUBJECT" | \
       cat $EXTRA_AUTOREPLY_HEADERS - $PMDIR/vacation.msg ; \
       echo "-- " ;  cat $HOME/.signature ) | $SENDMAIL -oi -t