package Mail::Audit::Razor; use Mail::Audit; use vars qw(@VERSION $config); $VERSION = '1.8'; 1; package Mail::Audit; use strict; use Razor::Client; use Razor::Agent; use Razor::String qw(hash); sub is_spam { my ($self) = @_; my @message = (split("\n", $self->header), "", "", @{$self->body}); my $razor = new Razor::Agent($Mail::Audit::Razor::config || "$ENV{HOME}/razor.conf"); my $response = $razor->check(sigs => [hash(\@message)]) || $razor->raise_error(); return $response->[0]; } sub spam_handle { my ($self, $data, $action) = @_; if ($self->is_spam) { $self->accept($data) if ($action eq "accept"); $self->ignore() if ($action eq "ignore"); $self->reject($data) if ($action eq "reject"); $self->pipe($data) if ($action eq "pipe"); return 1; } return 0; } sub spam_accept { &spam_handle(@_[0,1], "accept"); } sub spam_ignore { &spam_handle(@_[0,1], "ignore"); } sub spam_reject { &spam_handle(@_[0,1], "reject"); } sub spam_pipe { &spam_handle(@_[0,1], "pipe"); } 1; __END__ =pod =head1 NAME Mail::Audit::Razor - Mail::Audit plugin for the Vipul's Razor spam detection system =head1 SYNOPSIS use Mail::Audit qw(Razor); my $mail = Mail::Audit->new; ... $mail->spam_accept($spambox); $mail->accept; =head1 DESCRIPTION This is a Mail::Audit plugin that uses the Vipul's Razor distributed spam detection system to detect and deal with spam. It requires the C and C modules from C. While Razor never flags false positives, it has been having problems with false reporting. Until that gets fixed I'd advise against ignoring or rejecting spam with this module. =head2 METHODS =over 4 =item C Calls C and returns 1 if the message is spam, otherwise 0. =item C Calls C and returns 1 if the message is spam, otherwise 0. =item C Calls C and returns 1 if the message is spam, otherwise 0. =item C Calls C and returns 1 if the message is spam, otherwise 0. =item C Returns 1 if the message is spam, 0 if it is not. =head2 VARIABLES =item C<$Mail::Audit::Razor::config> The path to your razor config file. The default is C<$ENV{HOME}/razor.conf>. =head1 AUTHOR Nate Mueller =head1 SEE ALSO C and L