procmail
[Top] [All Lists]

Serving multiple files

1997-10-12 09:58:11
Continuing on this project:

I have an archive of suspected spam messages.  I want to be able to send
myself a message and request copies of these messages.

Requesting one message is simple, but I'd like to be able to request
multiple files and have the extracted messages sent to me one at a time.
I'd like to be able to send myself a message like:


Subject: Request Archive File

(in the body)
GetMessage: 23
GetMessage: 30
GetMessage: 34

And then have messages 23, 30, 34 dropped in my inbox.

Currently, I use formail to extract all message numbers to a file, then
fgrep each message in the archive against this file.

Is there any way to do this entirely within procmail?  Could I pipe the
numbers extracted by formail into a var, and then match against that?  But
I'd would need to "OR" against the var.

This is what I have so far using fgrep:

(I don't use formail +n -1 -s because the messages in the archive do not
start at zero.)


#============== Handle Requests for Archived files ===============

   # seems really rare that I'd send in more than on request at a time,
   # therefore don't need a lock file.

   :0i
   * ^Subject:.*Request Archive File
   * B ^GetMessage:[    ]*[0-9]+
   * ? test -f $SPAMDIR/archive.gz
   | formail -zx "GetMessage:" > archive.search; \
     gzip -dc $SPAMDIR/archive.gz|formail -s procmail EXTRACT=yes; \
     rm -f archive.search


   # here is where procmail is being called by formail -s above

   :0 # check if EXTRACT, and grab Subject while here
   * EXTRACT ?? yes
   * ^Subject:\/.*
   {

      # If this message's SpamID is in the archive.search file then deliver

      :0
      * ? (formail -zx"X-SpamID:") | fgrep -f archive.search
      {
         :0fhw
         | formail -I"Subject: Archived ($MATCH)"

         :0:         
         $ORGMAIL
      }


      # all other messages get dropped
      :0
      /dev/null
   }




Bill Moseley
mailto:moseley(_at_)netcom(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>
  • Serving multiple files, Bill Moseley <=