On Tue, 6 Aug 1996 21:58:10 -0400 (EDT), Eric Force
<eforce(_at_)acy(_dot_)digex(_dot_)net> said:
I've been getting a rash of requests like sendfile.name, send.file.name,
etc. so I would like to make a conditional test of $FILE such that if a
an incorrect request was received (empty $FILES?) then a back-up file
would be sent explaining that there was a problem with the orginal
request and to please check for case, spelling, etc. instead of them
receiving a blank message as the auto-response.
Here's what I use. Put this in a file, and INCLUDERC it from
.procmailrc. Put the files you want to make available in SENDDIR.
Detail instructions are available at
http://www.universe.digex.net/~mbr/unix/send-file.html
Mike
----
# Jun 19 1996 Mike Rose
# Jul 16 1996 Mike Rose Always write to log file.
MY_ADDR=${MY_ADDR:-$LOGNAME(_at_)stsci(_dot_)edu}
SENDDIR=${SENDDIR:-procmail-send}
SEND_FILENAME_REGEXP=[-_.a-zA-Z0-9]+
SEND_SUBJECT_PREFIX=${SEND_SUBJECT_PREFIX:-"send file +"}
SEND_FILE_LOG=${SEND_FILE_LOG:-"send-file.log"}
:0h
* $ ^Subject: $SEND_SUBJECT_PREFIX\/.*
* !^FROM_DAEMON
* $ ! ^X-Loop: $MY_ADDR
{
SUBJ=$MATCH
PATH=$PATH:/bin:/usr/bin
:0ch: $SEND_FILE_LOG$LOCKEXT
| echo "`date` : `formail -rtzxTo:` : $SUBJ" >> $SEND_FILE_LOG
:0
* $ ^Subject: $SEND_SUBJECT_PREFIX\/$SEND_FILENAME_REGEXP$
* ? test -f $SENDDIR/$MATCH
| (/usr/local/bin/formail -r -A"Precedence: junk" \
-A"X-Loop: $MY_ADDR" ; \
cat $SENDDIR/$MATCH) | $SENDMAIL -oi -t
:0 E
* $ ^Subject: $SEND_SUBJECT_PREFIX\/.*
| (/usr/local/bin/formail -r -A"Precedence: junk" \
-A"X-Loop: $MY_ADDR" ; \
echo "No such file: $MATCH"; \
echo ""; \
echo "Available files are:"; \
ls $SENDDIR |egrep "^$SEND_FILENAME_REGEXP\$") \
| $SENDMAIL -oi -t
}