procmail
[Top] [All Lists]

Re: send file [size] recipe wanted

1996-03-19 10:06:40
On Tue, 19 Mar 1996, The Doctor {Who?} wrote:

The basic concept is that I'd like for the recipe to be able to decode at
least two variables from a subject line of a msg. sent to me...

The format I'd like is:

send file [size]

(or maybe even: send format file [size])

What I need is a generic routine to pick each WORD (space separated only)
from the subject line, and parse it into separate variables.

Have you looked at this example from the procmailex man page?  It might 
help you some.

     Now follows an example for a very simple fileserver accessi-
     ble by mail.  For more demanding applications, I suggest you
     take a look at SmartList (available from the same  place  as
     the  procmail  distribution).   As  listed,  this fileserver
     sends back at most one file per request, it ignores the body
     of  incoming mails, the Subject: line has to look like "Sub-
     ject: send file the_file_you_want" (the blanks are  signifi-
     cant),  it  does  not  return files that have names starting
     with a dot, nor does it allow files to be retrieved that are
     outside  the  fileserver  directory  tree  (if you decide to
     munge this example,  make  sure  you  do  not  inadvertently
     loosen this last restriction).
 
          :0
          * ^Subject: send file [0-9a-z]
          * !^X-Loop: yourname(_at_)your(_dot_)main(_dot_)mail(_dot_)address
          * !^Subject:.*Re:
          * !^FROM_DAEMON
          * !^Subject: send file .*[/.]\.
          {
            MAILDIR=$HOME/fileserver # chdir to the fileserver directory
 
            :0 fhw                   # reverse mailheader and extract name
            * ^Subject: send file \/[^ ]*
            | formail -rA "X-Loop: 
yourname(_at_)your(_dot_)main(_dot_)mail(_dot_)address"
 
            FILE="$MATCH"            # the requested filename
 
            :0 ah
            | cat - ./$FILE 2>&1 | $SENDMAIL -oi -t
          }
 
---
Derrick Green
eusdegr(_at_)wser(_dot_)ericsson(_dot_)se
Richardson, Texas

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