Hello, I'm not sure if this belongs in the dev-list or not, but we have made some minor changes to SA in order for us to allow our users to create separate filters for mail that we consider to be "almost certainly" spam, versus mail that is "probably" spam.
It should be noted that this code was originally added to v2.63, but since our update, we've had to "shoehorn" it into v3.0.4 (on FC3). We have added variables for use in /etc/mail/spamassassin/local.cf file: required_hits_acspam 8 # hits needed to be classified as "almost certainly" spam idstring_acspam ! # token used in Subject header denoting "almost certainly" spam idstring_pspam ? # token used in Subject header denoting "probably" spam In addition, we added a variable "rewrite_subject_method" that we assign a value "prepend" to denote where in the Subject header the "[SPAM...]" should be inserted. This provides a feature we think others might find useful, and would appreciate it's inclusion in the code-base. Kind Regards, -richard duran
diff -Naur SpamAssassin/Conf.pm SpamAssassin.new/Conf.pm --- SpamAssassin/Conf.pm 2005-06-05 20:31:23.000000000 -0500 +++ SpamAssassin.new/Conf.pm 2005-07-10 15:54:21.000000000 -0500 @@ -3124,6 +3124,33 @@ } }); + # by Jorge Adrian Salaices to allow for Tagging of Almost Certainly Spam vs probably spam + # [EMAIL PROTECTED] + push (@cmds, { + setting => 'idstring_acspam', + default => '!', + type => $CONF_TYPE_STRING + }); + + push (@cmds, { + setting => 'idstring_pspam', + default => '?', + type => $CONF_TYPE_STRING + }); + + push (@cmds, { + setting => 'required_hits_acspam', + default => 15, + type => $CONF_TYPE_NUMERIC + }); + + push (@cmds, { + setting => 'rewrite_subject_method', + default => 'prepend', + type => $CONF_TYPE_STRING + }); + # end of code added by Jorge Adrian Salaices + =back =head1 TEMPLATE TAGS diff -Naur SpamAssassin/PerMsgStatus.pm SpamAssassin.new/PerMsgStatus.pm --- SpamAssassin/PerMsgStatus.pm 2005-06-05 20:31:23.000000000 -0500 +++ SpamAssassin.new/PerMsgStatus.pm 2005-07-10 15:32:58.000000000 -0500 @@ -888,6 +888,19 @@ $created_subject = 1; } + # Added by Jorge Adrian Salaices to allow for the tag to be changed if above a threshold + # that is considered almost certainly spam [EMAIL PROTECTED] + my $required_hits_acspam = $self->{conf}->{required_hits_acspam}; + my $idstring_pspam = $self->{conf}->{idstring_pspam}; + my $idstring_acspam = $self->{conf}->{idstring_acspam}; + # end of code added by Jorge Adrian Salaices + + # Added by Jorge Adrian Salaices, if hits >= required_hits_for_almost_certainly_spam then choose idstring_acspam + # else select idstring_pspam [EMAIL PROTECTED] + $self->{hits} = length($self->qp_encode_header($self->_process_header("Level","_STARS(*)_") || "")); + my $idstring = ( $self->{hits} >= $required_hits_acspam ) ? $idstring_acspam : $idstring_pspam; + # end of code added by Jorge Adrian Salaices + # Deal with header rewriting foreach (@pristine_headers) { # if we're not going to do a rewrite, skip this header! @@ -903,13 +916,41 @@ } # Figure out the rewrite piece - my $tag = $self->_replace_tags($self->{conf}->{rewrite_header}->{$hdr}); + # Modified by Jorge Adrian Salaices to replace the _IDSTRING_ with the value of $idstring + # [EMAIL PROTECTED] + #my $tag = $self->_replace_tags($self->{conf}->{rewrite_header}->{$hdr}); + my $tag = $self->{conf}->{rewrite_header}->{$hdr}; + # end of code modified by Jorge Adrian Salaices $tag =~ s/\n/ /gs; + # Added by Jorge Adrian Salaices to replace the _IDSTRING_ with the value of $idstring + # [EMAIL PROTECTED] + $tag =~ s/_IDSTRING_/$idstring/ig; + $tag = $self->_replace_tags($tag); + # end of code added by Jorge Adrian Salaices + # The tag should be a comment for this header ... $tag = "($tag)" if ($hdr =~ /^(?:From|To)$/); - s/^([^:]+:[ \t]*)(?:\Q${tag}\E )?/$1${tag} /i; + # Modified by Jorge Adrian Salaices to replace the _IDSTRING_ with the value of $idstring + # [EMAIL PROTECTED] + #s/^([^:]+:[ \t]*)(?:\Q${tag}\E )?/$1${tag} /i; + if ($hdr =~ /^Subject$/ and lc($self->{conf}->{rewrite_subject_method}) eq "prepend") { + #$subject =~ s/^(?:\Q${tag}\E |)/${tag} /g; + s/^([^:]+:[ \t]*)(?:\Q${tag}\E )?/$1${tag} /i; + } + else { + #$subject =~ s/(?: \Q${tag}\E|)(\cM?\cJ)$/ ${tag}$1/g; + #s/(?: \Q${tag}\E|)(\cM?\cJ)$/ ${tag}$1/i; + s/(?: \Q${tag}\E|)$/ ${tag}$1/i; + } + # end of code modified by Jorge Adrian Salaices + + # Added by Jorge Adrian Salaices remove extras spaces and newlines if they exist + # [EMAIL PROTECTED] + s/\n*$/\n/s; + s/[ \t]+/ /g; # can't use "\s" on left-side because that matches newline + # end of code added by Jorge Adrian Salaices } $addition = 'headers_spam';