From 198625e162b2cef538ef36e02343720e04818786 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 14 Nov 2012 15:21:44 -0500 Subject: [PATCH] spamassassin: added 'headers none' option enables suppression of SA header insertion --- plugins/spamassassin | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/spamassassin b/plugins/spamassassin index 6e81c7e..d3b9710 100644 --- a/plugins/spamassassin +++ b/plugins/spamassassin @@ -18,7 +18,7 @@ These are the common ones: score,required,autolearn,tests,version =head1 CONFIG Configured in the plugins file without any parameters, the -spamassassin plugin will add relevant headers from the spamd +spamassassin plugin will add relevant headers from spamd (X-Spam-Status etc). The format goes like @@ -67,6 +67,11 @@ domain sockets for spamd. This is faster and more secure than using a TCP connection, but if you run spamd on a remote machine, you need to use a TCP connection. +=item headers [none] + +By default, spamassasin headers are added to messages. To suppress header +insertion, use 'headers none'. + =item leave_old_headers [drop|rename|keep] Another mail server before might have checked this mail already and may have @@ -139,6 +144,7 @@ Make the "subject munge string" configurable use strict; use warnings; +use lib 'lib'; use Qpsmtpd::Constants; use Qpsmtpd::DSN; @@ -241,6 +247,12 @@ sub parse_spamd_response { sub insert_spam_headers { my ( $self, $transaction, $new_headers, $username ) = @_; + if ( $self->{_args}{headers} && $self->{_args}{headers} eq 'none' ) { + my $r = $self->parse_spam_header( $new_headers->{'X-Spam-Status'} ); + $transaction->notes('spamassassin', $r); + return; + }; + my $recipient_count = scalar $transaction->recipients; $self->_cleanup_spam_header($transaction, 'X-Spam-User'); # always clean up @@ -410,6 +422,8 @@ sub reject { sub munge_subject { my ($self, $transaction) = @_; + return if ($self->{_args}{headers} && $self->{_args}{headers} eq 'none'); + my $sa = $self->get_spam_results($transaction) or return; my $qp_num = $self->{_args}{munge_subject_threshold};