procmail
[Top] [All Lists]

Re: Multiple sort lines problem

2009-05-28 11:18:59
At 10:55 2009-05-28 +0100, Arthur Dent wrote:

What confuses me is that in the first section it *does* (or at least
seems to) work through sequentially and if any one of the conditions is
met (i.e. does NOT match the regex) it delivers to INBOX/Possiblespam.

Because ALL of the NOT conditions evaluate true.  They're ANDed.

You may need a refresher in boolean logic.

If a condition matches ("true"), then assign a value of 1, otherwise 0.

1 AND 0 = 0 (skip action)
0 AND 1 = 0 (skip action)
0 AND 0 = 0 (skip action)
1 AND 1 = 1 (take action) only when BOTH conditions match

In an OR logic - which one might normally use scoring for in procmail (see 'man procmailsc'), a lot more paths lead to taking the action:

1 OR 0 = 1 (take action)
0 OR 1 = 1 (take action)
0 OR 0 = 0 (skip action)  NEITHER condition matches
1 OR 1 = 1 (take action)


Using scoring, you can specify something like:

:0:
* 9876543210^0 ^TO_kiddie2\@(mymail|mydomain)
* 9876543210^0 ^Received.*for..kiddie2\@(mymail|mydomain)
INBOX/Kiddie2

Which will stop evaluating conditions as soon as one evaluates true (the number exceeds the "maximal" scoring value - otherwise, all the conditions would be evaluated, and as long as the score result was >0 when done, it'd take action).

BTW, it really appears as if you're using procmail as an MTA - trying to deliver mail intended for different users of a system (via your "catch-all" address). If this is the case, it's time for the procmail mantra: Procmail is NOT an MTA. You'll run into all sorts of problems if you try to make it work like one - chief among them will be when you receive a message destined for more than one user of your system (work through your logic and see what'll happen).

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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