Support for userprefs' reject threshold (#281)

If the reject argument is set to the string 'userprefs' instead of a decimal value, the required threashold value will be taken from spamassassin userprefs required_score instead of set to a static value. This allows a per-user based threshold value.
This commit is contained in:
mufus 2017-02-12 19:12:47 +01:00 committed by Matt Simerson
parent 226114297e
commit 65fd1b2150

View File

@ -32,7 +32,7 @@ the options. Confused yet? :-) It looks like this in practice:
=over 4
=item reject [threshold]
=item reject [threshold|userprefs]
Set the threshold where the plugin will reject the mail. Some
mail servers are so useless that they ignore 55x responses not coming
@ -42,6 +42,10 @@ retrying until the mail expires from their queue.
Depending on your spamassassin configuration a reasonable setting is
typically somewhere between 12 to 20.
By setting reject = userprefs, the required threshold will be taken
from spamassassin userprefs. Usually used in conjunction with
spamd_user = vpopmail.
The default is to never reject mail based on the SpamAssassin score.
=item munge_subject_threshold [threshold]
@ -424,6 +428,13 @@ sub reject {
return DECLINED;
};
if ($reject eq 'userprefs') {
$reject = $sa_results->{required} or do {
$self->log(LOGERROR, "error, reject disabled ($status, $learn)");
return DECLINED;
};
}
if ($score < $reject) {
if ($ham_or_spam eq 'Spam') {
$self->log(LOGINFO, "fail, tolerated, $status < $reject, $learn");