> 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.
Thanks for the great critique on style and syntax!
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
I coded the recipe this way, so that I can easily clone all of the
lines, then I only need to change the three variables at the beginning
to create a new recipe. I'm not sure what "parameterizing" comment
means. Certainly variables used across a number of recipes would be
better placed in a separate file or at least at the top of the file,
but variables used in single recipes are best placed near where they
are used. OK, I'll fess-up, those variables really were parameters in
m4 macros that I use to build the initial recipes, but I dropped using
m4, because having one pattern matching rule (vPat) was too limiting.
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
Thanks! I just tweaked the recipe until it worked (not a good
programming style). It's good to know how it really should be done.
Your suggestion should speed things up when I get those monster files
with megabyte MS-Word attachments (that usually only contain plain
text, sheesh).
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.
I agree. I used the full path as a "patch," because for a while there
were two versions of procmail on our system and I just hard-coded the
path to keep things working, until I got around to fixing my PATH.
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).
Good point. I apply all the "Filed-In" recipes after all the recipes
that might forward to others. I thought of using X-Filed-In, but with
my emacs RMAIL mode set to not display all headers, the X-Filed-In
field would not be visible.
Hope this helps,
Definitely. Thanks.
Best regards,
Bruce Rafnel
______________________________________