Skip to content

Commit

Permalink
Support for userprefs' reject threshold
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mufus authored Feb 12, 2017
1 parent 2261142 commit c8dbf64
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/spamassassin
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit c8dbf64

Please sign in to comment.