At 16:31 2000-12-14 -0700, Jim McMaster wrote:
I now have procmail running on my old mail server. The only part not working
is in generating an autoresponse telling the sender my email address has
changed. I have the following in .procmailrc:
[snip]
# File: autoreply.rc
# Description: Procmail script for autoreply to inquiry
#
# /* SBS 14 NOV 1996 13:18:23 */ Basic autoreply
#
# Autoreply a status message
# If it is looped or from the mailer daemon, do nothing more.
:0c
* !^FROM_DAEMON
* $!^X-Loop: $MYADDR
| ( formail -rt -A "X-Loop: $MYADDR" \
-I "Precedence: junk" \
-I "From: MYADDR (the McMaster mailbot)" ;\
cat $AUTOREPLY/newaddr.msg ) | $SENDMAIL -t
Set $AUTOREPLY to the path where the message file would be, and create the
newaddr.msg to be the body of the mesage you want to send. Set $MYADDR to
the email address you want the reply sent from. This is MUCH cleaner than
trying to emit the message body using a stack of echo statements, and the
whole recipe ports easily enough to other needs.
You may or may not want the FROM_DAEMON line in there, considering an
increasing number of boneh^H^H^H^H^Hpeople are using email addresses like
root and postmaster for regular mail (doh!).
*!$MY_XLOOP
Uh, that really should be something more like:
* $! ^X-Loop: $MY_XLOOP
You don't indicate what MY_XLOOP is defined as (well, I found it below in
the dead.letter), but most typically people set it to the email address of
the host account (and it isn't really a bad idea to stick to that
convention). If you don't look for it specifically on an X-Loop header
line, the darn thing wouldn't match because the address is likely to be
found in a header like To: or Received:. Further, if the macro isn't
expanded, then the raw text probably won't match anything in the headers
and will result in a non-match (which, when !inverted, means this would
always match).
| (echo "From: mcmaster(_at_)jcm(_dot_)stortek(_dot_)com" ;
\
You're better off defining From: by using formail itself. Also, while I
might be wrong, the syntax of this is suspect - you're not piping it anywhere.
$FORMAIL -rt -A"Precedence: junk" \
-A"X-Loop: $MY_XLOOP" -A"Subject: My email address has changed"; \
-A isn't correct for changing the Subject - it ADDS a line, reguardless of
whether there is one by that name or not. You should use -I for headers of
which there should only be one. See 'man formail'
echo " My email address has changed\n" \
Pardon my ignorance, but exactly when did echo start recognizing the
c-style character escapes?
-----------------------------------------------------
procmail: Match on ! "MY_XLOOP"
Is this not indicative of anything to you?
---
Please DO NOT carbon me on list replies. I'll get my copy from the list.
Sean B. Straw / Professional Software Engineering
Post Box 2395 / San Rafael, CA 94912-2395
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail