procmail
[Top] [All Lists]

RE: Any logical combination of conditions

2001-04-09 10:14:31

What I want to do is to combinate conditions.
Examples:

(cond1 AND cond2 AND cond3) OR (cond4 AND cond5) OR cond6

Is there a general algorithm or a general way of composing those
combinations?

Sure!  Put your action items (i.e. what you want to have happen) in a separate
file and use INCLUDERC.

This can be done nice and clean:

:0
* ^Cond1
* ^Cond2
* ^Cond3
{ INCLUDERC=action.rc }

:0
* ^Cond4
* ^Cond5
*!^X-Note: action.rc processed
{ INCLUDERC=action.rc }

:0
* ^Cond6
*!^X-Note: action.rc processed
{ INCLUDERC=action.rc }

(Note, put this as one of the first lines in "action.rc"

        formail -A"X-Note: action.rc processed"

and that will keep it from duplicating efforts, i.e. if a message that comes in
that matches conditions 4 and 5 AND 6 there's probably no need to have it run
through the action.rc twice.... you could use the "E" flag too, but I prefer the
X-Note: method because I like to have headers telling me what has been done to
the message anyway. YMMV & "there's more than one way to do it."

TjL

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