Xref: utzoo comp.mail.elm:1149 comp.sources.d:3361 comp.unix.wizards:14842 news.sysadmin:2155 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!ka From: ka@june.cs.washington.edu (Kenneth Almquist) Newsgroups: comp.mail.elm,comp.sources.d,comp.unix.wizards,news.sysadmin Subject: Re: autoreply - How to ??? Message-ID: <7393@june.cs.washington.edu> Date: 25 Feb 89 03:49:09 GMT References: <138@sysadm.UUCP> <1989Feb20.183114.28745@ateng.ateng.com> Organization: U of Washington, Computer Science, Seattle Lines: 36 chip@ateng.ateng.com (Chip Salzenberg) writes: > According to bjorn@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