You might be able to make something work with !~, but the easy way is to use a 
meta rule to reverse the sense.

header __TO_TEST    To =~ /my name/i
meta    TO_TEST    !__TO_TEST
score TO_TEST 5

I'm going to assume you know the FP consequences of something like this, and 
not bother with the standard disclaimer about this being in general a bad idea 
if scored at more than a point or two.

        Loren
  ----- Original Message ----- 
  From: John Minnihan 
  To: users@spamassassin.apache.org 
  Sent: Monday, February 19, 2007 6:48 PM
  Subject: Custom To: rule variant to exclude matches?


  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.

  Is this type of rule possible?  If so, how might I implement it?

-- 
John Minnihan
Founder, Freepository
http://freepository.com
Software development infrastructure since 1999

Blog: http://commavee.com

Reply via email to