autoreply - How to ???
Kenneth Almquist
ka at june.cs.washington.edu
Sat Feb 25 13:49:09 AEST 1989
chip at ateng.ateng.com (Chip Salzenberg) writes:
> According to bjorn at sysadm.UUCP (Bjorn Satdeva):
>> I need a good method to set up automagically reply with a preset
>> messages to incomming mail on a few special accounts.
>
> The "deliver" program, recently posted to comp.sources.unix and currently
> at patchlevel eight, should be able to handle this.
>
> [Chip then gives a sample user delivery file.]
The proposed script has the problem that it blindly replies to any mail,
and can thus get into an infinite loop if a mailer problems develop or if
someone else is running the same script. A simple fix is to only reply
to the *first* piece of mail from an individual:
# User delivery file for auto-reply.
autoreply=/u/myname/autoreply
echo "$1" # Always deliver normally
case $SENDER in
*!*)
if fgrep -x "$SENDER" $autoreply > /dev/null 2>&1
then :
else mail "$SENDER" <<-EOF
Subject: Automatic reply
To: $SENDER
This is an automatic reply. Blah, blah.
EOF
echo "$SENDER" >> $autoreply
;;
esac
Kenneth Almquist
More information about the Comp.unix.wizards
mailing list