This patch handles whitelisted recipients correctly. If the recipient was whitelisted by DSPAM, the spam score will always be zero. --- original/amavisd 2006-05-22 22:50:47.000000000 +0200 +++ modified/amavisd 2006-05-22 22:57:16.000000000 +0200 @@ -14801,6 +14801,11 @@ return $self->_get_set_value("confidence", $confidence); } +sub is_whitelisted { + my($self, $is_whitelisted) = @_; + return $self->_get_set_value("is_whitelisted", $is_whitelisted); +} + sub insert_dspam_headers { my($self, $insert_dspam_headers) = @_; return $self->_get_set_value("insert_dspam_headers", $insert_dspam_headers); @@ -14931,6 +14936,8 @@ $self->confidence($header_value); } elsif ($header_name eq "X-DSPAM-Probability") { $self->probability($header_value); + } elsif ($header_name eq "X-DSPAM-Result") { + $self->is_whitelisted($header_value eq "Whitelisted"); } $self->add_header($header_name, $header_value); } @@ -15048,11 +15055,15 @@ # changes as soon I have a distribution of DSPAM probabilities from my servers. # The basic idea was to use mainly the probability but high confidence values # should increase the score in its original direction. +# +# If the sender is whitelisted by DSPAM, the function returns 0. # The function below should give you a range from -10 to +20. -# Felix Schwarz, April 2006 +# Felix Schwarz, May 2006 sub compute_spam_level($$$) { my($self, $probability, $confidence) = @_; - if ($confidence > 0.5) { + if ($self->is_whitelisted()) { + return 0; + } elsif ($confidence > 0.5) { return 20 * ($probability - 0.5) * (1 + $confidence - 0.5) + 5; } else { return 20 * ($probability - 0.5) + 5;