procmail
[Top] [All Lists]

Conditional Test Question

1996-08-06 19:00:02
Hi Folks,

I've just begun offering a free "autoresponder" service as a promotional
activity for my clip art web sites and, as long as the request is typed
correctly, all goes fine. My .procmailrc script looks for the word "send"
and then a specific filename on the Subject line which would typically
look like: send file.name

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 my .procmailrc file:

          :0 c
          * !^X-Loop: infomart(_at_)acy(_dot_)digex(_dot_)net
          * !^Subject:.*Re:
          * !^FROM_DAEMON
          * ^Subject:.*send
          {
            MAILDIR=$HOME/fileserver   # chdir to the fileserver directory

            :0 h             # extract the requested filename(s)
            FILES=| sed -n -e 's/^Subject:.*send \(.*\)/\1/p' | (tr -d '/')

            :0 f                # reverse the mailheader
            | formail -rA "X-Loop: infomart(_at_)acy(_dot_)digex(_dot_)net"

            :0
            | (cat; cat $FILES) | $SENDMAIL -oi -t
           
          }

Any suggestions would be MOST appreciated!

Best Regards and MANY THANKS in advance,

Eric  

+----------------------------------------------------------------------+
| Eric Force       The Clip Art Connection - Now 2 Sites to Serve You! |
| (609) 567-2292   NJ/USA: http://www.acy.digex.net/~infomart/clipart/ |
| eforce(_at_)acy(_dot_)digex(_dot_)net       CA/USA: 
http://www.dobe.com/clipart/      |
+----------------------------------------------------------------------+

<Prev in Thread] Current Thread [Next in Thread>