Hi all,

I use mimedefang to call SpamAssassin (v2.63) to check the contents for SPAM, and wanted to modify the X-Spam-Status header, which I append to *all* messages that get scanned with the scores of each test that hit. This way I could check headers to see the scores in case a message squeeked by below my required hits threshold.

Since there is no method to do this, I implemented the following method in PerMsgStatus.pm:

---BEGIN---
###########################################################################

=item $list = $status->get_scores_of_tests_hit ()

After a mail message has been checked, this methid can be called. It will
return a comma-separated string, listing all the symbolic test names
of the tests which were trigged by the mail with the test score separated
by '='.

=cut

sub get_scores_of_tests_hit {

  my ($self) = @_;
  my $line = '';
  foreach my $test (sort @{$self->{test_names_hit}}) {
    $line .= ',' if ($line);
    $line .= $test . "=" . $self->{conf}->{scores}->{$test};
  }
  return $line;
}

---END---

I have this in a production system and now get the following header:

X-Spam-Status: No, hits=0.6 required=7.5
        tests=DATE_IN_PAST_12_24=0.385,FROM_ENDS_IN_NUMS=0.869,
              SARE_HEAD_XBEEN=-0.628
        version=2.63

Which gives me more information which I can log and generate nice stats of the test *with* scores.


-- Jorge Valdes Intercom El Salvador [EMAIL PROTECTED]




Reply via email to