procmail
[Top] [All Lists]

Re: filtering mail for recipients only within certain domains

1999-09-14 05:10:31
Maybe I need to give a couple examples. The solution below doesn't cover
my requirements. I want to be able to specify that all mail containing
recipient addresses in those domains (but not containing _any_ other
domains in the addresses) gets put into a folder. 

For example this set of headers:

To: bozo(_at_)aol(_dot_)com, theclown(_at_)hotmail(_dot_)com
Subject: ...

should get caught by the correct recipe. However this set of headers:

To: bozo(_at_)aol(_dot_)com, someone(_at_)otherdomain(_dot_)com
Subject: ...

should not get caught by the same recipe. Is that clear? It is easy to do
what you've almost specified - which is match all messages containing at
least one recipient in the specified domains. What is difficult (very, as
far as I can tell), is to capture messages containing only addresses in
the specified domains, but no others.

Thanks,
-Eric

On Mon, 13 Sep 1999, S.Toms wrote:

On Mon, 13 Sep 1999, Eric Hagberg wrote:

eh> I've been trying to figure this one out, but can't seem to come up with
eh> a solution. Perhaps someone else out there has done this before...
eh> 
eh> Is there a way to get procmail to filter messages that only contain
eh> addresses in a particlar domain or domains, but not any others. For
eh> example, if I wanted to capture all messages that contained @aol.com or
eh> @hotmail.com, but no other domains in the recipient addresses, is this
eh> possible?
eh> 

  Not sure by what you mean by capturing, do you mean you want to only
receive mail from those addresses or do you want to not receive email from
those addresses?

  If you want to receive only those, try something like the following:

:0
* !^(From.|Received:).*(aol.com|hotmail.com)
/dev/null

  If you don't want to receive them, try the same without the exclamation
mark :/

-- 
     S.Toms - tomas(_at_)primenet(_dot_)com - http://www.primenet.com/~tomas
                S.u.S.E. Linux v6.1+ - Kernel 2.2.11

Human beings were created by water to transport it uphill.



Eric Hagberg,       hagberg(_at_)ms(_dot_)com,      (212)762-2558
Morgan Stanley, 750 Seventh Avenue, New York, NY 10019