procmail
[Top] [All Lists]

Re: Environment Variable Set By Procmail With The Condition Matched?

2002-10-21 12:47:06
From: Todd Goodman <tgoodman(_at_)sonusnet(_dot_)com>

Is there an envrionment variable set by Procmail that contains the
matched condition?

No.

I basically want all my spam rules to use formail to insert a header
that gives this so I can tune the conditions to get rid of false
positives.  I'm using $MATCH right now and I really need the matched
condition.

I know this is in the log, but there's too much information to log all
the time.

I know I could also hard code the info in the rule itself (e.g. |formail
-a "X-Filter-Rule: Rule #100"), but I'd rather use the same actions for
all my rules if possible.

Instead of running formail for each recipe, you will want to collect
into a variable information on which was triggered.  Then write the
header at the end of that section.

        :0
        * some conditions
        { RX = "${RX:+$RX, }100" }

        :0
        * other conditions
        { RX = "${RX:+$RX, }101" }

        :0
        * other conditions
        { RX = "${RX:+$RX, }102" }

        :0
        * other conditions
        { RX = "${RX:+$RX, }103" }

Etc.

Then, below:

        :0 fhw
        * RX ?? .
        | formail -I"X-Recipe: $RX"


That's very close to what I do.

-- 
Dallman Ross


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail