Jay Lee wrote: > with some perl scripting, one could probably get something similar with > Spamassassin at SMTP time
A simple SpamAssassin module for Courier::Filter might look like the following. I just hacked it together off the top of my head, so it hasn't been tested, but I will probably include a tested one in the next release of C:F. A documented version is attached. ----8<----snip----8<---- package Courier::Filter::Module::SpamAssassin; use warnings; use strict; use base qw(Courier::Filter::Module); use Mail::SpamAssassin; sub new { my ($class, %options) = @_; my $spamassassin = Mail::SpamAssassin->new({ rules_filename => $options{rules_file_name} }); $spamassassin->compile_now(); my $module = $class->SUPER::new( %options, spamassassin => $spamassassin ); return $module; } sub match { my ($module, $message) = @_; my $class = ref($module); my $spamassassin = $module->{spamassassin}; my $sa_message = $spamassassin->parse($message->text); my $status = $spamassassin->check($sa_message); my $is_spam = $status->is_spam; my $score = $status->get_score; my $tests_hit = $status->get_names_of_tests_hit; $status->finish(); return 'SpamAssassin: Message looks like spam (score: ' . $score . '; ' . $tests_hit . ')' if $is_spam; return undef; # otherwise. } 1;
SpamAssassin.pm
Description: Binary data