Need help with rule set

Mark Sapiro mark at msapiro.net
Wed Jul 29 15:55:16 IST 2009


MailScanner 4.78.2

I have a ruleset for "Notices To" like the following

To: /^postmaster(\+.*)?[@.]example\.(net|org)$/ address1
To: /[@.]example\.(net|org)$/ and To: !/^postmaster/ address2
FromOrTo: default address3

The intent is to send virus notices for mail sent to the postmaster
address in the example.net and example.com domains to address1; to
send notices for mail sent to other addresses in the example.(com|net)
domains to address2, and to send notices for mail to other domains to
address3.

The first rule works fine. A notice for mail sent to
postmaster at example.net is sent to address1.

The problem is that a notice for mail to user at example.net is sent to
the default address3 instead of address2.

Does !/regexp/ work the way I've used it here? Is there something wrong
with what I'm doing?

Note that if the second rule is just

To: /[@.]example\.(net|org)$/ address2

Then notices for postmaster at example.net mail get sent to both address1
and address2 which is expected for an "all match" ruleset, but not
what I want. I really want to say

To: /[@.]example\.(net|org)$/ and NOT To: /^postmaster/ address2

and I thought

To: /[@.]example\.(net|org)$/ and To: !/^postmaster/ address2

would do it, but it doesn't seem to. It appears that I can do this with
a negative lookahead regexp as in

To: /[@.]example\.(net|org)$/ and To: /^(?!postmaster)/ address2

but in a more complex case the ability to say "doesn't match regexp"
without using negative lookahead seems useful.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the MailScanner mailing list