[Mimedefang] Filtering Based On Results of Spamassassin

Michael Sims msims at mail.crye-leike.com
Mon Mar 3 13:43:00 EST 2003


Quoting Jeffrey Thompson <jeffrey at thompsonic.com>:

> Just looking at the MIMEDefang Filter (5) man page so far I can see that
> I can call spam_assassin_check($hits, $required, $tests, $report) and
> then do a regular expression scan on $report for PORN_4 or HOT_NASTY.  

If you just want a list of tests that the message matched you could get it from $tests.  This should work:

my @tests = split(/,/ => $tests);

Getting the actual value of the tests would involve having to parse out $report.  I'm doing this right now to attach an HTML version of the report to the email.  I grab everything after the "Content analysis details:" line until the end of the document, then I split it on \n, then I do this:

foreach (@lines) {
  if (/^(\S+)\s+(\(.*?\))\s+(.*)$/) {
    ...
  }
}

$2 would contain the hits (with the parentheses).  Of course those hit values are constant according to your local config so there's probably a better way to get them than scanning for them all the time.

Anyway, FWIW...

___________________________________________
Michael Sims
Project Analyst - Information Technology
Crye-Leike Realtors
Office: (901)758-5648  Pager: (901)769-3722
___________________________________________



More information about the MIMEDefang mailing list