procmail
[Top] [All Lists]

filtering to two folders

1995-11-13 01:29:11
I thought I understood how to construct a recipe, but obviously not;
I'm trying to put filtered copies of mail into two different folders,
and thought using the c flag to carbon-copy on the first recipe would
do the trick.  I've experimented with various combinations of c, w, a
and A flags and braces and got various results, none of which are
what I expect.  So here's what I thought should do it, and some
comments I added to justify myself (the comments weren't in for the
test). The two formail filters are identical for this test, but in
real life they'd be different.  That's why there are two separate recipes.

The recipes within the braces should succeed unconditionally, I should think.
The :0 a: recipes exist to specify local lock files for the delivery part,
after we've been through the filters.

File test2 never sees anything; Can somebody explain the flaws in my reasoning?
Why is the first Folder: line in the log empty?
Thanks for any help,
jimo(_at_)eskimo(_dot_)com
----------------------------------------------

Here's the .procmailrc file:
PATH=/u/j/jimo/.bin:/bin:/usr/bin:/usr/local/bin
SHELL=/bin/bash
VERBOSE=on
LOGABSTRACT=all
MAILDIR=/u/j/jimo/Mail
DEFAULT=$MAILDIR/mbox
LOGFILE=$MAILDIR/log

#Eliminate all Received: lines
:0 fh
| formail -I Received:

:0 H   #Decide to enter this block by looking at these header fields
* ^From.*jimo
* ^Subject: test
{
    #Clone the mail so the following recipe can use it too.
    #Pass the header and body to formail as a filter.
    :0 cf
    | formail -k -X From -X From: -X Subject: -X Date: -X Message-Id:
        :0 a:   #If the previous recipe (:0 cf) suceeded, put the output
        test1   #of the filter into test1 using a local lockfile.

    #pass the header and body to formail as a filter
    :0 f
    | formail -k -X From -X Message-Id: -X From: -X Subject: -X Date: 
        :0 a:   #If the previous recipe (:0 f) suceeded, put the output
        test2   #of the filter into test2 using a local lockfile.
}
----------------------------------

Here's the log:
procmail: Executing "formail,-I,Received:"
procmail: Match on "^From.*jimo"
procmail: Match on "^Subject: test"
procmail: Executing 
"formail,-k,-X,From,-X,From:,-X,Subject:,-X,Date:,-X,Message-Id:"
From jimo(_at_)mail(_dot_)eskimo(_dot_)com  Sun Nov 12 23:04:43 1995
 Subject: test
  Folder:                                                                     0
procmail: Locking "test1.lock"
procmail: Assigning "LASTFOLDER=test1"
procmail: Opening "test1"
procmail: Acquiring kernel-lock
procmail: [8823] Sun Nov 12 23:04:46 1995
procmail: Unlocking "test1.lock"
From jimo(_at_)mail(_dot_)eskimo(_dot_)com  Sun Nov 12 23:04:43 1995
 Subject: test
  Folder: test1                                                            1805
procmail: Notified comsat: "jimo(_at_)14728:/u/j/jimo/Mail/test1"

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