SpamAssassin is a neat Email filter that tags incoming mails it thinks are spam. Its aggressiveness can be configured, and it comes with a decent default level. It's written in Perl and is licensed under the same license as Perl itself. You can use procmail(1) to run SpamAssassin, or you might want to use MailScanner to run it on all your incoming mail. You might even want to plug VipulsRazor into it.
(Note, this product will assassinate Spam, but will leave SPAM well alone!)
poll mail.myisp.co.nz protocol POP3 user "pop3user" password "secret" is user "localuser" here mda "/usr/bin/procmail";
# correct incoming messages for programs like Evolution and mail :0 fhw | formail -I "From " -a "From " :0fw | spamassassin
#!/bin/bash /usr/bin/fetchmail >> ~/log/fetchmail
*/5 * * * * /home/localuser/bin/getmail
This plugin submits the entire email to a locally running ClamAV server for virus detection. If a virus is found, it returns a positive return code to indicate spam and sets the header X-Spam-Virus: Yes ($virusname). If you'd like to sort virus emails to a separate folder, create a rule looking for this header.
It requires
To install, create the files in /etc/mail/spamassassin/. You can adjust the default score of 10 in clamav.cf if you like. Restart the spamd daemon if you're using that, and you should be all set.
loadplugin ClamAV clamav.pm full CLAMAV eval:check_clamav() describe CLAMAV Clam AntiVirus detected a virus score CLAMAV 10
package ClamAV; use strict; use warnings; use Mail::SpamAssassin; use Mail::SpamAssassin::Plugin; use File::Scan::ClamAV; our @ISA = qw(Mail::SpamAssassin::Plugin); sub new { my ( $class, $mailsa ) = @_; my $self = $class->SUPER::new( $mailsa ); bless( $self, $class ); $self->register_eval_rule( "check_clamav" ); return $self; } sub _set_header { my ( $msgstatus, $header ) = @_; $msgstatus->{ main }->{ conf }->{ $_ }->{ "Virus" } = $header for qw( headers_spam headers_ham ); } sub check_clamav { my ( $self, $permsgstatus, $fulltext ) = @_; my $clamav = File::Scan::ClamAV->new( port => 3310 ); my ( $code, $virus ) = $clamav->streamscan( ${ $fulltext } ); if ( !$code ) { my $errstr = $clamav->errstr(); Mail::SpamAssassin::Plugin::dbg( "ClamAV: Error scanning: $errstr" ); _set_header( $permsgstatus, "Error ($errstr)" ); } elsif ( $code eq 'OK' ) { Mail::SpamAssassin::Plugin::dbg( "ClamAV: No virus detected" ); _set_header( $permsgstatus, "No" ); } elsif ( $code eq 'FOUND' ) { Mail::SpamAssassin::Plugin::dbg( "ClamAV: Detected virus: $virus" ); _set_header( $permsgstatus, "Yes ($virus)" ); return 1; } else { Mail::SpamAssassin::Plugin::dbg( "ClamAV: Error, unknown return code: $code" ); _set_header( $permsgstatus, "Error (Unknown return code from ClamAV: $code)" ); } return; } 1;
GreigMcGill has found that MaiaMailguard? is an excellent meta tool for managing your anti spam solution.
lib/main.php:944: Notice: PageInfo: Cannot find action page