THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
No Format |
---|
sub check_example() { my ( $self, $pms ) = @_; ... #You do all your tests and whatever else here ... #Now we assume that the score you calculated is in $score #optional: #Ifchange the scoredescription isfor 0,report thenand yousummary don't need to domy anything (obviously) if($score) {$description = $pms->{conf}->{descriptions}->{EXAMPLE_RULE_NAME}; $description .= " -- #Fetchwith the description of your rule from the configuration filescore $score"; my $description = $pms->{conf}->{descriptions}->{EXAMPLE_RULE_NAME} = $description; #If the score is 0, then you don't need to do anything (obviously) if($score) { #The magic call $pms->>got_handle_hit("EXAMPLE_RULE_NAME", $score, "HEADER: ", $descriptionscore => $score); #Yet another magic call for my $set (0..3) { $pms->{conf}->{scoreset}->[$set]->{"EXAMPLE_RULE_NAME"} = sprintf("%0.3f", $score); } } return 0; } |
And thats it. The
No Format |
---|
_handlegot_hit ($rule, $score, $area, $description%params) |
Wiki Markup |
---|
call will trigger a hit for the specified rule with the specified score. Area means for example BODY or HEADER, so this has to be changed according to what you are |
doing. (See \[http://spamassassin.apache.org/full/3.2.x/doc/Mail_SpamAssassin_PerMsgStatus.html Mail::SpamAssassin::PerMsgStatus\] for other possible params.) |
The rule description is accessible with
No Format |
---|
$pms->{conf}->{descriptions}->{EXAMPLE_RULE_NAME} |
. It is usually set by
No Format |
---|
describe EXAMPLE_RULE_NAME |
in the rules file but can also be changed at runtime.
Setting
No Format |
---|
$pms->{conf}->{scoreset}->[$set]->{"EXAMPLE_RULE_NAME"} |
Wiki Markup |
---|
lets the dynamic score appear in the template tag _TESTSSCORES_, which might be used for the X-Spam-Status line. (The for loop is necessary to set all 4 values, for their explanation see \[http://spamassassin.apache.org/full/3.12.x/doc/Mail_SpamAssassin_Conf.html Mail::SpamAssassin::Conf\] item {{score SYMBOLIC_TEST_NAME n.nn}} ) |
...