procmail
[Top] [All Lists]

Re: Two Incoming Folders

1999-07-15 18:37:32
On Thu, 15 Jul 1999 17:37:09 -0700 (PDT), bruce rafnel
<rafnelb(_at_)mayfield(_dot_)hp(_dot_)com> wrote:
Reply-to: bar(_at_)techie(_dot_)com

(What's this? I'm replying to the list for now.)

On Wed, 14 Jul 1999, JT wrote:
If a message matches a recipe, how can I specify
two local folders to save it to?  (I want to 
Here's how I solved this problem.  By adding "Filed-In:" to the header
of filed messages, I can usually do a quick skim of my main mail box,

That's a useful idea; I just have a couple of minor comments.

If you are parametrizing stuff into variables, why not go all the way
and put the constant part in an external rc file (or, conversely,
parametrize less)?

# ----------------------
vRule=1
vFile=procmail.in
vPat="^TO(procmail|smartlist)|^Reply-To:.*procmail"
:0 cf
* $!^Filed-In: $vFile
* $$vPat
| /opt/procmail/bin/formail -bA "Filed-In: $vFile [$vRule]"
     :0cA:
     $vFile

You should probably use different flags. c together with f is always
wrong (I nearly wrote "almost always" but I honestly can't think of a
case where it's right), and by the way, you can simplify a little by
filtering only the headers (you use more flags but push around less
data and don't need a -b option on the call to formail ... not that
it's actually needed here, either). Finally, you should probably use a
w flag when filtering:

    :0fbw
    * $ ! ^Filed-In: $vFile
    * $ $vPat
    | formail -A "Filed-In: $vFile [$vRule]"
        :0cA:
        $vFile

I have omitted some self-evident stuff here; the path to formail is
missing because I honestly think it's better to use base names and
instead make sure your PATH is correctly set up, for most purposes.

The choice of field name is pretty much your own business as long as
you can make sure these Filed-In: headers don't leak out onto the
Internet at large. On the other hand, just to be on the safe side, you
should perhaps use an X- header name (X-Filed-In).

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

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