procmail
[Top] [All Lists]

Re: conditional sort

1998-11-20 13:53:54
THANK YOU. I have mail that I divert successfully from mailing lists based
on who's sending them into separate folders, but I did it by order not
expression, by putting them before the recipe for the list in my
.procmailrc. The problem I had with this particular list was ALL mail sent
from the list was using a single return address so I wanted to see if I
could just grep through it using a particular member's name as a string
and if a match was found send it to the folder intended and if not send it
along unprocessed as another rule further down would catch it and send it
the the right folder. Your mail has given me enough information to
straighten out my confusion. Thanx again.

On Fri, 20 Nov 1998, Lars Kellogg-Stedman wrote:
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



-M    
                             


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