procmail
[Top] [All Lists]

Re: conditional sort

1998-11-20 12:42:53

I have a mailing list I belong to and I want all mail sent to a given
folder EXCEPT mail from a specific person.

I'm going to assume that you want the mail for the "specific person" to be
delivered normally, rather than being discarded.

I know that I don't have it
currently setup correctly.

In cases like this, it can be helpful to post what you *do* have; you
might already be close.

Can someone give me a recipe example of the
best way to handle the situation?

Sure.

First, you're looking for mail TO a specific list.  Taking this list as an
example, the corresponding condition line might look a little bit like this:

  * ^TO_procmail

(It's possible to match more strictly against the list name, but I'm being
lazy).

You want to match all mail to the above address that is not from a certain
person (in this example, me):

  * ! ^From:[   ]*lars(_at_)bu(_dot_)edu

Keeping in mind that procmail ANDs together multiple condition lines (in other
words, ALL condition lines must match for the recipe to match), you can
simply combine these into a final recipe:

  :0:
  * ^TO_procmail
  * ! ^From:[   ]*lars(_at_)(_dot_)*bu(_dot_)edu
  lists/procmail

In english, that's: "match all messages addressed to procmail AND NOT from
lars(_at_)bu(_dot_)edu".

At this point, mail from me addressed to the list would either be match by
a subsequent recipe, or would end up in your default system mailbox.  If you
simply wanted to discard everything I sent, you could add the following
recipe after the previous one:

  :0
  * ^From:[     ]*lars(_at_)(_dot_)*bu(_dot_)edu
  /dev/null

If you *only* wanted to discard message of mine sent to the list (that is,
you still wanted to see my email in other lists), you might combine 
everything like this:

## match all mail to procmail
:0
* ^TO_procmail
{
  ## match all mail to procmail that is not from me, and file it into
  ## a folder.
  :0:
  * ! ^From:[   ]*lars(_at_)(_dot_)*bu(_dot_)edu
  lists/procmail

  ## if the preceding recipe didn't execute, that means I sent the message,
  ## so we'll discard it.
  :0E
  /dev/null
}

Hope this helps,

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