procmail
[Top] [All Lists]

Re: 'OR'ed conditions

1997-03-26 10:52:36
These conditions are 'And'ed, so all of them have to be satisfied.

Is there a way to specify 'OR'ing of these conditions, or do I need
to do a separate recipe for each of them?

There are two ways (that I can think of at the moment) to achieve an ORing
of conditions. 

One option is to use the OR ('|') symbol in your conditions.  This lets
you chain multiple regular expressions together on a single condition
line:

:0:
* (^From:.*lars)|(^Subject:.*foo)
larsbox

That will match either a message FROM me or or with SUBJECT containing the
word foo.  You can build rather complex expressions this way, at the
expense of legibility (of course, that last assessment is entirely
subjectice).

You could also use weighted scoring to achieve a similar effect.  Remember
that the initial score of a recipe is 0, and that the recipe will be
evaluated if the weighted conditions result in a total positive score for
the current message.

:0:
* 1^0 ^From.*lars
* 1^0 ^Subject.*foo
larsbox

A match on either condition will increase the score by 1, making the total
score positive, so the message will go to larsbox.  If both match, the
score is still positive (just larger).

-- Lars

---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University

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