Thanks for the quick reply & bonus suggestion, Matt. I'll continue modeling this now that I know !~ should function as expected, i.e. "return true if the pattern is not matched".
> John Minnihan wrote: >> SA Team, >> >> I have a fully functional SA installation that is serving me very >> well. I use Mailscanner and a few custom rules, and am generally >> very pleased with the results. >> >> Thereâs one more rule that Iâd like to run, but havenât figured >> out >> how to implement it. I want to use a header rule that will trigger on >> any mail sent to my domains that is to an address that is *not* in my >> test block, for example: >> >> header TO_ADDRESS_BOGUS To !~ /my|real|addresses|here/i >> describe TO_ADDRESS_BOGUS To: contains bogus address >> score TO_ADDRESS_BOGUS 5.0 >> >> I know about blacklists and whitelists and have a solution in place >> that works ok, but I really want a header rule like the one above. >> Yes, Iâve searched. Yes, I have found many rules that implement a To: >> match test but have not found an rule that implements a non-match >> test. I suspect that my use of !~ is incorrect, but lint is happy with >> that rule as-is. >> > > Your use of !~ should work properly here. > > However, I might suggest using ToCc instead of To. This will at least > match mail that's Cc'ed to you... > > Of course, neither will match any mail that's Bcc'ed to you, including > mailing list posts (ie: this list). So make sure you whitelist anyone > who will send you Bcc'ed mail. > > -- John Minnihan Founder, Freepository http://freepository.com Software Development Infrastructure since 1999