procmail
[Top] [All Lists]

Re: Can These 2 Recipes Be Or'd?

2004-05-09 16:23:07
On Mon, May 10, 2004 at 08:23:07AM +1000, Marvin R. Pierce wrote:
Wondering it these can be combined into a single recipe?

:0:
* 
^(To|Cc|Bcc).*(xxxxxxx(_at_)teebookglobal(_dot_)com|xxxxxxx(_at_)303Sport(_dot_)com)
/dev/null

:0:
* ^Received:.*boxer\.([a-z0-9_-]+\.)?com\.au
spam/

I presume you would send to spam/ in either case.

You have a problem with lockfiles in both recipes above, btw.  In
the first, you do not want a lockfile for /dev/null.  In the second,
you do not want a lockfile for a maildir-style folder.


How to OR in procmail has been discusses many times, so you might
want to search the archives for case-sensitive "OR".  But basically
there are three ways to do it.  The first is very ugly, and I don't
recommend it:

 :0  f l a g s
 * ^((To|Cc|Bcc).*xxxxxxx@(teebookglobal|303Sport)[.]com|\
      Received:.*boxer[.]([a-z0-9_-]+[.)?com[.]au)
 spam/


The second way uses scoring, for which see "man procmailsc".
We use a number of at least 2**31-1 to get procmail to skip
right to the action line in a case where a weighted condition
matches (evaluates true):

 :0  f l a g s
 * 9876543210^0  first condition
 * 9876543210^0  second condition
 spam/


The third way uses "reverse De Morgan" logic to accomplish an OR
by way of "not A  AND  not B":

 :0  f l a g s
 * ! first condition
 * ! second condition
 { }  # do nothing

 :0 E  # else
 spam/


Okay, that's two recipes again, but it's still useful to rely on
sometimes.

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