On Thu, Sep 18, 2003 at 09:55:12AM -0700, Mitch (WebCob) wrote:
> What am I missing?
> 
> I tacked this on to the end of 20_head_tests.cf (note key info obscured to
> protect the innocent, but the pattern match works in a test perl script - is
> there another way to test a rule?)
> 
> header MY_CLIENTS             X-CustomHeader =~ /^MY PATTERN$/
> describe MY_CLIENTS   Message contains login or user information
> authenticating local user
> score                         MY_CLIENTS -10.0
> 
> Doesn't seem to run - are all X-headers available for testing? Or do I have
> to add support somewhere else?

Erm ... 

You really ought to leave 20_head_tests.cf unchanged, since it is 
subject to complete replacement when you upgrade or reinstall SA. 

Put it in /etc/mail/spamassassin/<foo>.cf, for arbitrary <foo>. 

As to the ruleset, something like this might work: 

header ODOT_<foo-name>  ALL =~ /X-CustomHeader:\s*MY_PATTERN$/
or 
header MY_CLIENTS     X-CustomHeader =~ /\s^MY_PATTERN$/
or
header MY_CLIENTS     X-CustomHeader =~ /\s.*MY_PATTERN$/

Note that even those require your pattern to be the very last thing
on the line. Even one character following it will cause the match
to fail. You might want to allow trailing whitespace, thus:

header MY_CLIENTS     X-CustomHeader =~ /\s.*MY_PATTERN\s*$/

unless you can be *sure* that there never will be any. 

I don't see how this: 

header MY_CLIENTS     X-CustomHeader =~ /^MY PATTERN$/

would ever work, because you're matching on /^MY PATTERN$/,
which has to start at the beginning of the line, and 
X-CustomHeader should be at the beginning of the line. 

But I may be all wet and talking out my ... hat, let's say.

-- 
Mike Andrews
[EMAIL PROTECTED]
Tired old sysadmin since 1964


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to