procmail
[Top] [All Lists]

Re: Multiple sort lines problem

2009-05-28 12:32:36
On Thu, May 28, 2009 at 08:17:34AM -0700, Professional Software Engineering 
wrote:
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)

Yes I think I've got that now...

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).

Thanks for that. If you see my post, which must have crossed with yours,
you'll see that I stumbled across this myself. This is what I came up
with:

:0:
* 1^0 ^TO_(me|myothername)\@(mymail|mydomain)
* 1^0 ^Received.*for..(me|myothername)\@(mymail|mydomain)
INBOX/Me

I had never come across scoring before today.
Can you explain the significance of 9876543210 in your recipe vs the 1
in mine?

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).

Fair point... I have however been using this method quite successfully
in my little family server without problem for some years now. In truth
the recipes are a little more complex than I have portrayed here and
make use of some copy commands as well as delivery commands to overcome
the problem you rightly point out. I admit it's not perfect but it works
for me and it's an awful lot easier than trying to get to grips with
Sendmail!

Thanks again...

Mark
 

Attachment: pgpFuWKQRU0iZ.pgp
Description: PGP signature

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