procmail
[Top] [All Lists]

Mike's Unix Tools and Techniques: send-fil

1997-10-30 02:25:24
Hi,

I've been trying to implement this guys recipe to be albe to send files
on demand ,by checking for a line in Subj: plus the filename.

http://www.universe.digex.net/~mbr/unix/send-file.html

I installed it, but the files the users get a scrambled, just trash -
not uudecoded even. I'd like for example netscape readers to get it as
an attachment. Maybe Multipart message ? I don't know I m new to
procmail.

I send along his recipe, since he didn't respond to my email , I hope
any of u can help me out...I need this...
please take a look at it - thx a whole lot !

# Jun 19 1996 Mike Rose
# Jul 16 1996 Mike Rose  Always write to log file.

MY_ADDR=${MY_ADDR:-$LOGNAME}
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/bin/formail -r -A"Precedence: junk" \
           -A"X-Loop: $MY_ADDR" ; \
           cat $SENDDIR/$MATCH) | $SENDMAIL -oi -t

        :0 E
        * $ ^Subject: $SEND_SUBJECT_PREFIX\/.*
        | (/usr/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
}


-- 
Christophe Zwecker                email: doc(_at_)rrz(_dot_)uni-hamburg(_dot_)de
Hamburg, Germany                    fax: 49 40 22715433

<Prev in Thread] Current Thread [Next in Thread>
  • Mike's Unix Tools and Techniques: send-fil, Christophe Zwecker <=