MCP filtering by Subject line

James Gray james_gray at OCS.COM
Mon Apr 5 22:53:24 IST 2004


Erick Perez wrote:
> Hi, I like to use MCP to filter some messages based on the SUBJECT field 
> that include some words that the regular spamassassin cant catch.
> 
> I do not understand the format of the file so can someone please tell me 
> how to implement that?
> 
> For example: filter subject field that contains words like “marketing” 
> or “new cd release”
> 
> Thanks,

IIRC the MCP code uses the spamassassin (SA) engine and it's own 
filters.  The format is (should be?) the same as any other SA filter 
definitions.

SA uses PERL REGEX, as opposed to POSIX REGEX.  Basically rules are in 
triplets:

MATCH      <perl regex here>
DESCRIBE   <plain text here>
SCORE      <integer or float here>

(Julian - are scores used in MCP checks or is it simply a true/false 
check?  ie, If anything matches the MCP action is triggered)

So to catch the strings you mention above you might want something like 
this:

header MCP_SUBJ_MARKETING        Subject =~ /\bmarketing/i
describe MCP_SUBJ_MARKETING      MCP Checks found 'marketing' in subj.
score MCP_SUBJ_MARKETING         2.0

That regex explained: The "/"...."/" delimits the regex pattern. "\b" is 
a word boundary; basically white space or a non-word character. The "i" 
on the end makes it non-case-sensitive.

Subjects, To/From, etc are all "header" checks.  There are heaps of 
other checks like "body", "uri", "rawbody" etc.  Check out the 
documentation Julian suggested for more info.  Doing some googling for 
"Perl Regex" will put you in front too.

Cheers,

James




More information about the MailScanner mailing list