-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Attached is a patch that makes the following headers optional: X-Spam-Checker-Version X-Spam-Flag X-Spam-Status
They all default to on, but there are now configuration options to turn them off: spam_checker_version 0 spam_flag 0 spam_status 0 Also, there is a "no_report" option. When enabled, NO report is placed into the message. I have never had a need for the body report, as it messes up the message. The header report adds way too much information, even with use_terse_report on. If I need to see which tests were trigged, X-Spam-Status is enough for me. - -- Richie Laager Wikstrom Telecom Internet -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE81WrkbfU6uV4fG84RAky9AKDOK38OdPsbSFr6W7ThYdfTEk9JFQCg23KD M56i46oAvarBMQBhNBYo6Lg= =V7XJ -----END PGP SIGNATURE-----
Index: lib/Mail/SpamAssassin/Conf.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/Conf.pm,v retrieving revision 1.62 diff -u -r1.62 Conf.pm --- lib/Mail/SpamAssassin/Conf.pm 2 May 2002 07:24:02 -0000 1.62 +++ lib/Mail/SpamAssassin/Conf.pm 5 May 2002 17:21:30 -0000 @@ -106,9 +106,13 @@ $self->{auto_whitelist_factor} = 0.5; $self->{rewrite_subject} = 1; + $self->{spam_checker_version} = 1; + $self->{spam_flag} = 1; $self->{spam_level_stars} = 1; + $self->{spam_status} = 1; $self->{subject_tag} = '*****SPAM*****'; $self->{report_header} = 0; + $self->{no_report} = 0; $self->{use_terse_report} = 0; $self->{defang_mime} = 1; $self->{skip_rbl_checks} = 0; @@ -280,6 +284,29 @@ $self->{rewrite_subject} = $1+0; next; } +=item spam_checker_version { 0 | 1 } (default: 1) + +By default, a header field called "X-Spam-Checker-Version" will be added to +the message, with its value set to a string describing the version of +SpamAssassin being used. + +=cut + + if(/^spam[-_]checker[-_]version\s+(\d+)$/) { + $self->{spam_checker_version} = $1+0; next; + } + +=item spam_flag { 0 | 1 } (default: 1) + +By default, a header field called "X-Spam-Flag" will be added to the message, +with its value set to YES, if the message has been flagged as SPAM. + +=cut + + if(/^spam[-_]flag\s+(\d+)$/) { + $self->{spam_flag} = $1+0; next; + } + =item spam_level_stars { 0 | 1 } (default: 1) By default, a header field called "X-Spam-Level" will be added to the message, @@ -296,6 +323,19 @@ $self->{spam_level_stars} = $1+0; next; } +=item spam_status { 0 | 1 } (default: 1) + +By default, a header field called "X-Spam-Status" will be added to the message, +with its value set to a string that tells if a message was flagged as SPAM, the +number of hits, the number of hits required to be flagged as SPAM (See required_hits), +and the name(s) of the test(s) hit. + +=cut + + if(/^spam[-_]status\s+(\d+)$/) { + $self->{spam_status} = $1+0; next; + } + =item subject_tag STRING ... (default: *****SPAM*****) Text added to the C<Subject:> line of mails that are considered spam, @@ -306,6 +346,17 @@ if (/^subject[-_]tag\s+(.+?)\s*$/) { $self->{subject_tag} = $1; next; + } + +=item no_report { 0 | 1 } (default: 0) + +By default, SpamAssassin will include a report in the body/header of suspected spam. +Enabling this causes the report to be ommitted. + +=cut + + if (/^no[-_]report\s+(\d+)$/) { + $self->{no_report} = $1+0; next; } =item report_header { 0 | 1 } (default: 0) Index: lib/Mail/SpamAssassin/PerMsgStatus.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/PerMsgStatus.pm,v retrieving revision 1.103 diff -u -r1.103 PerMsgStatus.pm --- lib/Mail/SpamAssassin/PerMsgStatus.pm 2 May 2002 01:49:28 -0000 1.103 +++ lib/Mail/SpamAssassin/PerMsgStatus.pm 5 May 2002 17:21:30 -0000 @@ -360,16 +360,25 @@ $self->get_names_of_tests_hit(), $Mail::SpamAssassin::VERSION); - $self->{msg}->put_header ("X-Spam-Status", $_); - $self->{msg}->put_header ("X-Spam-Flag", 'YES'); + if($self->{main}->{conf}->{spam_status} == 1) + { + $self->{msg}->put_header ("X-Spam-Status", $_); + } + if($self->{main}->{conf}->{spam_flag} == 1) + { + $self->{msg}->put_header ("X-Spam-Flag", 'YES'); + } if($self->{main}->{conf}->{spam_level_stars} == 1) { $self->{msg}->put_header("X-Spam-Level", "*"x int($self->{hits})); } - $self->{msg}->put_header ("X-Spam-Checker-Version", + if($self->{main}->{conf}->{spam_checker_version} == 1) + { + $self->{msg}->put_header ("X-Spam-Checker-Version", "SpamAssassin $Mail::SpamAssassin::VERSION ". "($Mail::SpamAssassin::SUB_VERSION)"); + } # defang HTML mail; change it to text-only. if ($self->{conf}->{defang_mime}) { @@ -389,7 +398,7 @@ } } - if ($self->{conf}->{report_header}) { + if (!$self->{conf}->{no_report} && $self->{conf}->{report_header}) { my $report = $self->{report}; $report =~ s/(?:\n|^)\s*\n//gm; # Empty lines not allowed in header. $report =~ s/\n\s*/\n /gm; # Ensure each line begins with whitespace. @@ -406,8 +415,7 @@ } $self->{msg}->put_header ("X-Spam-Report", $report); - - } else { + } elsif (!$self->{conf}->{no_report}) { my $lines = $srcmsg->get_body(); my $rep = $self->{report}; @@ -461,10 +469,12 @@ $self->get_names_of_tests_hit(), $Mail::SpamAssassin::VERSION); - $self->{msg}->put_header ("X-Spam-Status", $_); + if($self->{main}->{conf}->{spam_status} == 1) { + $self->{msg}->put_header ("X-Spam-Status", $_); + } if($self->{main}->{conf}->{spam_level_stars} == 1) { - $self->{msg}->put_header("X-Spam-Level", "*"x int($self->{hits})); + $self->{msg}->put_header("X-Spam-Level", "*"x int($self->{hits})); } $self->{msg}->get_mail_object; }