diff --git a/plugins/spamassassin b/plugins/spamassassin index 8d64352..8bac5a5 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -375,18 +375,21 @@ sub check_spam_reject { $self->log(LOGERROR, "skip: error getting spamassassin score"); return DECLINED; }; + + my $ham_or_spam = $sa_results->{is_spam} eq 'Yes' ? 'Spam' : 'Ham'; + my $reject = $self->{_args}{reject} or do { - $self->log(LOGERROR, "skip: reject threshold not set, default pass ($score)"); + $self->log(LOGERROR, "skip: reject not set ($ham_or_spam, $score)"); return DECLINED; }; if ( $score < $reject ) { - $self->log(LOGINFO, "pass, $score < $reject"); + $self->log(LOGINFO, "pass, $ham_or_spam, $score < $reject"); return DECLINED; }; # default of media_unsupported is DENY, so just change the message - $self->log(LOGINFO, "deny, $score > $reject"); + $self->log(LOGINFO, "deny, $ham_or_spam, $score > $reject"); return Qpsmtpd::DSN->media_unsupported("spam score exceeded threshold"); } diff --git a/t/plugin_tests/spamassassin b/t/plugin_tests/spamassassin index 5ec6625..67018b4 100644 --- a/t/plugin_tests/spamassassin +++ b/t/plugin_tests/spamassassin @@ -82,13 +82,13 @@ sub test_check_spam_reject { # message scored a 10, should pass $self->{_args}{reject} = 12; - $transaction->notes('spamassassin', { score => 10 } ); + $transaction->notes('spamassassin', { is_spam => 'Yes', score => 10 } ); my $r = $self->check_spam_reject($transaction); cmp_ok( DECLINED, '==', $r, "check_spam_reject, $r"); # message scored a 15, should fail $self->{_args}{reject} = 12; - $transaction->notes('spamassassin', { score => 15 } ); + $transaction->notes('spamassassin', { is_spam => 'Yes', score => 15 } ); ($r) = $self->check_spam_reject($transaction); cmp_ok( DENY, '==', $r, "check_spam_reject, $r"); };