Subject: Re: autoreply recipes

From: Mano Pallewatta <[email-masked]>
Date: Sun, 29 May 1994 16:55:54 +0700 (GMT+0700)

Hi,
        I have developed the following script which allows you to store
all the files in a directory.  Any mail with the subject line "send
<file-name>" will send you the required file. If the file is not found or
if you send the word "help" in the an "ls -l" listing of all files will be
sent. I use splitmail to mail large messages in chunks. (Thanks to Roman
Czyborra <[email-masked]> ). This recepie also allows you to
upload files and sends mail to a mailing list when new files are added to
the auto-replier. If the file already exists it will be renamed with
extension .old added. Everything is logged in folder AUTO-RQ.

These are the lines in my .procmailrc which are relevant.

# Extracting the file name by deleting words send, putcopy the blanks and
# converting to lower case. This is place at the begining of .procmailrc . 

SHELL=/bin/sh
FILENAME=`formail -xSubject: | \
          sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
              -e s/putcopy//g -e s/send//g -e s/" "//g`

:0
* ^TOslna-request
{

# Archive upload system
# Only I am allowed to upload files but this may be modified for multiple 
# senders.

:0 wbc:/home/image/Img-Proc/auto-reply/$FILENAME$LOCKEXT
* ^Subject: *putcopy
* ^From +pall
| if test -f /home/image/Img-Proc/auto-reply/$FILENAME ; \
        then    mv /home/image/Img-Proc/auto-reply/$FILENAME \
        /home/image/Img-Proc/auto-reply/$FILENAME.old;\
        fi;\
        cat > /home/image/Img-Proc/auto-reply/$FILENAME

        :0 ahc
        | (formail -rA"Cc: [email-masked]";\
           echo "Archive Updated.") | $SENDMAIL -t

        :0 a
        |( cat > /dev/null; echo -n "Archive has been updated with the file ''";\
        echo -n $FILENAME; echo "''.";\
        echo "Please send mail to <[email-masked]> with"; echo ;\
        echo -n "Subject: send ";\
        echo $FILENAME; echo ;\
        echo "to obtain your copy.";)\
        |/usr/ucb/mail -s "Archive updated" [email-masked]

# Archive retrival system

:0
* !^X-Loop: [email-masked]
{

:0 c:
* ^Subject: *send
AUTO-RQ

        :0 A:/home/image/Img-Proc/auto-reply/$FILENAME$LOCKEXT
        |(formail -rA"X-Loop: [email-masked]";\
        if test -f /home/image/Img-Proc/auto-reply/$FILENAME ; \
        then cat /home/image/Img-Proc/auto-reply/$FILENAME;\
        else echo "File not available in archive."; \
        echo "The following files are available."; \
        ls -l /home/image/Img-Proc/auto-reply |sed -e /$FILENAME$LOCKEXT/d; \
        fi) | splitmail -s 95000 -d

:0 c:
* ^Subject: *help
AUTO-RQ

        :0 A
        | (formail -r -A"X-Loop: [email-masked]";\
        echo "The following files are available."; \
        ls -l /home/image/Img-Proc/auto-reply)| $SENDMAIL -oi -t

        }

:0:
SLNA-Requests

}

+-----------------------------------+---------------------------------------+
|  Mano Pallewatta                  |    Internet: [email-masked]        |
|  Computer Science Program         |                                       |
|  Asian Institute of Technology    |    Phone: +66 2 524 5720              |
|  GPO Box 2754, Bangkok 10501      |    Fax  : +66 2 524 5721              |
|  Thailand.                        |                                       |
|                                   |                                       |
+-----------------------------------+---------------------------------------+