Subject: Re: Auto-Reply

From: [email-masked] (David W. Tamkin)
Date: Sun, 26 Feb 1995 14:51:02 -0600 (CST)

Aaron Herskowitz asked,

| I created an account "info" and added the following recipes to info's  
| .procmailrc (mostly from the procmailex man page):
| 
| :0 h c
| * !^FROM_DAEMON
| * !^X-Loop: [email-masked]
| | (formail -r -A"Precedence: junk" \
|     -A"X-Loop: [email-masked]" ; \
|     cat autoreply.txt ) | $SENDMAIL -t
| 
| # we don't want to save any of the messages
| :0
| /dev/null

First, get rid of the `c' flag on the first recipe.  That will be a faster
way of junking incoming mail if it matches the conditions.  (You'll still
need the sink to /dev/null for mail that doesn't match the conditions: i.e.,
for mail that does match ^FROM_DAEMON or ^X-Loop: [email-masked].)

Second, since the incoming pieces are likely to be short, using the `b' flag
on the sink to /dev/null will make it faster.  (If the pieces are likely to
be long, use `h' instead, but either will be an improvement over neither.
Come to think of it, if we take off the `c' flag, the only things needing the
sink will be error messages or looping mail, so they probably will have
bodies longer than their heads.)

| This works great, but I would like to do one more additional thing -  
| At the bottom of the message, I would like to include a line of text  
| "[original information request message follows]" and then the  
| original message (header and all.)

Headers and all?  If you would be content with the body alone, it would be
easier.  Oh well then, here it is.  First, add a blank line and "[original
information request follows]" at the foot of your autoreply.txt file, make
sure that autoreply.txt starts with an empty line, and try this:

 :0whf # duplicate head at top of body
 * !^FROM_DAEMON
 * !^X-Loop: [email-masked]
 | sed 'H; $G'
  :Ahwf # invert (first) head and tack on file
  | formail -r -A"Precedence: junk" -A"X-Loop: [email-masked]" ; \
    cat autoreply.txt
  :A 
  ! -oi -t

 :0h
 /dev/null

It will fail if the head is over 5000 characters, though, because that will
overload sed's hold space.