[PATCH] SpamAssassing plugin now saves results in a note
[email protected] (Matt Simerson)
| Newsgroups | perl.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
---
plugins/spamassassin | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/plugins/spamassassin b/plugins/spamassassin
index 4ca890e..534d712 100644
--- a/plugins/spamassassin
+++ b/plugins/spamassassin
@@ -11,6 +11,9 @@ from the SpamAssassin package. F<http://www.spamassassin.org>
SpamAssassin 2.6 or newer is required.
+Stores the results in a note named spamass (for other plugins). The note
+format is 3 fields joined with a colon: is_spam:score:autolearn
+
=head1 CONFIG
Configured in the plugins file without any parameters, the
@@ -243,6 +246,12 @@ sub insert_spam_headers {
next; # Mail::Header mangles this prefolded header
# $self->log(LOGDEBUG, $new_headers->{$name} );
};
+ if ( $name eq 'X-Spam-Status' ) {
+ my ( $is_spam,undef,$score,$autolearn ) = $new_headers->{$name}
+ =~ /^(yes|no), (score|hits)=([\d\.\-]+)\s.*?autolearn=([\w]+)/i;
+ $self->log(LOGINFO, "SA: $is_spam; $score; $autolearn");
+ $transaction->notes('spamass', "$is_spam:$score:$autolearn");
+ };
$new_headers->{$name} =~ s/\015//; # hack for outlook (still necessary?)
$self->_cleanup_spam_header($transaction, $name);
$transaction->header->add($name, $new_headers->{$name}, 0);
--
1.7.9.6