procmail
[Top] [All Lists]

Re: (il)logical algebra

2004-03-24 16:47:31
On Thu, Mar 25, 2004 at 12:24:41AM +0100, Stefan Heinrichsen wrote:
For spamfiltering I set the header "X-To-Whitelist" and "X-Blacklist". I
want a mail to be filterd if: both headers are yes, none of them or only
X-Blacklist.

So it would be like
  A | (A & B) | (!A & !B)
= A | (!A & !B) 
= A | !B

So I use the rule
* ^X-Blacklist: Yes | !^X-To-Whitelist: Yes

If I now receive a mail containing none of this both headers I get:
No match on "^X-Blacklist: Yes | !^X-To-Whitelist: Yes"

where is the mistake?

Well, it's easier if we use procmail's natural ANDing of conditions.

First of all, if you see X-Blacklist is set you want to filter, right?


  :0
  * ^X-Blacklist: Yes
  do_something

Otherwise, if X-Blacklist is NOT set, then *only if X-Whitelist
is also unset, do something:

  :0 E  # use the "else" flag if above recipe was nondelivering
  * ! ^X-Whitelist: Yes
  do_something


That "not" syntax takes care of either no X-Whitelist or one
that exists but is set to No (or anything other than Yes).

Alles klar?

-- 
dman
  

_______________________________________________
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>