procmail
[Top] [All Lists]

Re: Simplyfying my 'mailinglists.rc'

1998-02-14 11:55:32
Michael Andersson asked,

| OK, I've looked through the man page, and it seems that multiple
| conditions in a recipe are AND-ed. How does one OR several conditions?

If possible, one combines them.  The general case of how to OR uncombinable
conditions is another matter, that I won't need to get into here.

First, I see the way you are capitalizing "^FROM".  If you thought that there
was a special ^FROM token that expands like ^TO and ^TO_, there isn't (and
Stephen has said that there never will be).  If you want to match on either
the Unix From_ line or the RFC822 From: header, use ^From[: ] -- I suggest
specifying the character after the m in case someone decides to get cute and
put in header lines like these:

Fromme: should have stayed on the wharf
or
Fromage: camembert today, brie tomorrow

| Is there some way to combine them? It would be great to be able
| to put together something like this:
| 
|         :0:
|         * ^FROM.*nasa.gov
|       * ^TOssrt-news
|       * ^TOJPLNews
|       * ^FROM.*NASANews
|         00-Space
| 
| If my understanding is correct, however, this will only work if
| the email fulfulls all four of those conditions...

Right.  They'd be ANDed.  To OR them, since they are non-negated regexp
conditions, just glue them with pipes:

  :0:
  * ^From[: ].*nasa\.gov|^TOssrt-news|^TOJPLNews|^From[: ].*NASANews
  00-space

It can be further reduced to this:

  :0:
  * ^TO(ssrt-|JPL)news|^From[: ](.*\>)?nasa(\.gov|news)
  00-space

You might want to file mail from other lists (such as this one) first just in
case somebody posts to one of them from an address in the nasa.gov domain.