procmail
[Top] [All Lists]

Re: Consider LOGFILE and Subject in same recipe

2004-03-18 14:07:34
At 15:05 2004-03-18 -0500, Christopher Benson wrote:
Isn't this an AND type situation though?

Time to check out simple logic tables


        OR = INVERTED AND

OR truth table:

        1 or 1          1
        1 or 0          1
        0 or 1          1
        0 or 0          0

AND truth table:

        1 and 1         1
        1 and 0         0
        0 and 1         0
        0 and 0         0

Understand that much?

Okay. Originally you were NOT'ing the values. If you omit the NOT, then consider the bit values to be opposite of the logic you were originally contending with (that is, if your NOT of some condition resulted in a TRUE, then the condition would normally be FALSE).

Lay the logic out longhand:

        1       0       LOGFILE = account1
        1       0       subject = something you are matching

        0       1       LOGFILE = account2
        1       0       subject = something you are matching

        1       0       LOGFILE = account1
        0       1       subject = something you are NOT matching

        0       1       LOGFILE = account2
        0       1       subject = something you are NOT matching

The two numbers are if you're matching naturally, and what the NOT (inverted) result of that match would be. For instance:

        * ! LOGFILE ?? account1

would be the second column, because you're inverting it.

Follow so far?

Now, if you eliminate the inversion of the condition, then the ONLY thing which would match if you AND is the first one - where BOTH conditions match.

Either of which is currently the reason you WOULD NOT invoke your code.

Which is why there's a null recipe, followed by:

:0E
{
        # Do stuff
}

which says "if the PREVIOUS recipe (without the E flag) didn't match, then run this".

IOW, run it for any of the three remaining pairs of conditions in the above table - each of which has at least one of the conditions matching in your inverted logic case.

It will look to see if the LOGFILE is account 1 AND if the subject is a bunch of items right? This isn't necessarily going to be true for the emails. If it works like OR then that would work. LOGFILE OR subject is bunch of items. I have several accounts that use the same recipes so that's why I'm trying to get this to work. For one of the accounts (account1 in this example) I want to bypass the "Do stuff" part while the other accounts should run it as long as they don't match one of the subject words.

Then you should carefully re-evaluate the logic. BTW, "LOGNAME" is the name of the user account for which the message is being delivered. Probably more sensible than LOGFILE.

If you check the archives, I've posted several mechanisms for opting in and out of certain global procmailrc filter rules. using GROUPS is one such way.

---
 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(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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