chip@ateng.ateng.com (Chip Salzenberg) (02/21/89)
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 system here is is SysV without sendmail, but with smail added. The "deliver" program, recently posted to comp.sources.unix and currently at patchlevel eight, should be able to handle this. For example, this user delivery file not only delivers messages normally, it also replies automatically to all messages originating off-site. # User delivery file for auto-reply. echo "$1" # Always deliver normally case $SENDER in *!*) mail $SENDER <<-EOF Subject: Automatic reply To: $SENDER This is an automatic reply. Blah, blah. EOF ;; esac -- Chip Salzenberg <chip@ateng.com> or <uunet!ateng!chip> A T Engineering Me? Speak for my company? Surely you jest! "It's no good. They're tapping the lines."
ka@june.cs.washington.edu (Kenneth Almquist) (02/25/89)
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