procmail
[Top] [All Lists]

Re: How to OR conditions

2002-05-29 08:02:29
Olivier asked,

| I have an /etc/procmailrc that looks like the following:
|
|         # EXCEPTION 1
|         :0 :
| * ^From root
| * ^Subject: Quarantined messages
| * ^Reply-To: quarantine(_at_)cs(_dot_)ait(_dot_)ac(_dot_)th
| $DEFAULT
|
| #EXCEPTION 2
| :0 :
| * ^From root
| * ^Subject: Cron
| $DEFAULT
|
| #EXCEPTION 3
| :0 :
| * ^From quarantine(_at_)cs(_dot_)ait(_dot_)ac(_dot_)th
| $DEFAULT
|
| :0fw
| | filter spam

| But if a user has his own ~/.procmailrc file, it is not considered for
| the delivery of the emaiL corresponding to exception 1-3, especially
| if the user has set his own $DEFAULT.
|
| So, I'd rather write:
|
| :0fw
| * ! EXCEPTION 1
|         * ! EXCEPTION 2
|         * ! EXCEPTION 3
|         | filter for spam
|
| Filter for spam only if no exception is triggered, else continue with
| the rcfile (and especially with the user's rcfile).
|
| But as the exception contains ANDed condition, negating them would
| lead to ORed conditions.

The complication here is that the first two exceptions are not determined by
single conditions but by the ANDs of three (for exception 1) or two (for
exception 2) conditions, so the general methods for ORing conditions
(alternating regexps with pipe symbols, using supremum scores, or the
double-reverse DeMorgan trick) won't work here.

For a case like this, I suggest an accumulation tactic.  Since the first two
exceptions have one condition in common, there are five total:

:0
* 1^0 ^From root
* 10^0 ^Subject: Quarantined messages
* 10^0 ^Reply-To: quarantine(_at_)cs\(_dot_)ait\(_dot_)ac\(_dot_)th
* 100^0 ^Subject: Cron
* 1000^0 ^From quarantine(_at_)cs\(_dot_)ait\(_dot_)ac\(_dot_)th
{ }
SKIPSCORE = $=

:0fw
* ! SKIPSCORE ?? 1...|(10|2)1$
| spamfilter

If the score has a 1 and three more digits to the right of it, the message met
exception 3.
If the score ends in 101, the message met exception 2.
If the score ends in 21, the message met exception 1.

If the score does not match any of those patterns, that's when we should
filter the message for spam content.





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

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