procmail
[Top] [All Lists]

Re: What's the difference between "* ^TO*xxx" and "* ^To:.*xxx"

1999-06-03 05:05:45
On Thu, 3 Jun 1999, Mihai Preda wrote:

I want to filter all mails which come to "<anything>@dom.com"
What should I use:

* TO*(_at_)dom(_dot_)com
Or
* To:(_dot_)*(_at_)dom(_dot_)com
?

And what's the difference between the two?
In my oppinion, accordind to the egrep syntax, the first form shouldn't
work, but it seems it does.

The first form matches (case insensitive by default) "t" then "any
(including zero) number of 'o's", then @dom.com (period slopped over).

The second matches "to:", then "any (including zero) number of
characters", then "@dom.com" (slop the period).

I'm not sure how the first form is matching what you want.
Also, were there ^ in the original, like:
* ^TO*
?
That would change the meaning, as ^TO would get substituted by a big,
hairy regex, ending in ), so the * would say "any (including zero) number
of these specific 'to' addresses) followed by @dom.com, which WILL match
anything that has (by default in the Header) any message that has @dom.com
in it (like in the Subject, or Received, or ...).

Having 
* ^To:.*dom.com

is _closer_ to what you want, but ff you want to match anything coming to
a certain address, then use ^TO or ^TO_ specifically; they're special to
procmail and will catch most emails that are sent to a specific
destination. You'll need a decently recent version of procmail.

-jeff
-- 
       "We are too busy mopping the floor to turn off the faucet."