Mail::SpamAssassin - Mail::Audit spam detector plugin
my $mail = Mail::SpamAssassin::NoMailAudit->new();
my $spamtest = Mail::SpamAssassin->new(); my $status = $spamtest->check ($mail);
if ($status->is_spam ()) { $status->rewrite_mail (); $mail->accept("spamfolder");
} else { $mail->accept(); # to default incoming mailbox } ...
Mail::SpamAssassin is a module to identify spam using text analysis and several internet-based realtime blacklists.
Using its rule base, it uses a wide range of heuristic tests on mail headers and body text to identify ``spam'', also known as unsolicited commercial email.
Once identified, the mail can then be optionally tagged as spam for later filtering using the user's own mail user-agent application.
This module also implements a Mail::Audit plugin, allowing SpamAssassin to be
used in a Mail::Audit filter. If you wish to use a command-line filter tool,
try the spamassassin
or spamd
tools provided.
Note that, if you're using Mail::Audit, the constructor for the Mail::Audit
object must use the nomime
option, like so:
my $ma = new Mail::Audit ( nomime => 1 );
SpamAssassin also includes support for reporting spam messages to collaborative filtering databases, such as Vipul's Razor ( http://razor.sourceforge.net/ ).
Mail::SpamAssassin
object. You may pass the
following attribute-value pairs to the constructor.
rules_filename
and userprefs_filename
.
Mail::SpamAssassin::PerMsgStatus
object. Used for debugging.
If none of rules_filename
, userprefs_filename
, or config_text
is set,
the Mail::SpamAssassin
module will search for the configuration files in the
usual installed locations.
Mail::Audit
object, to determine if
it is spam or not.
Returns a Mail::SpamAssassin::PerMsgStatus
object which can be
used to test or manipulate the mail message.
Note that the Mail::SpamAssassin
object can be re-used for further messages
without affecting this check; in OO terminology, the Mail::SpamAssassin
object is a ``factory''. However, if you do this, be sure to call the
finish()
method on the status objects when you're done with them.
Otherwise identical to $f-
check()> above.
Mail::Audit
object, as human-verified spam.
This will submit the mail message to live, collaborative, spam-blocker
databases, allowing other users to block this message.
Options is an optional reference to a hash of options. Currently these can be:
Mail::Audit
object,
explaining that their message has been added to spam-tracking databases
and deleted. To be used in conjunction with report_as_spam
. The
$replysender
argument should contain an email address to use as the
sender of the reply message.
Note that the $mail object is not modified.
setuid()
.
DBI
module is installed, and the
configuration parameters user_scores_dsn
, user_scores_sql_username
, and
user_scores_sql_password
are set correctly.
Mail::SpamAssassin::PersistentAddrList
for the API these factory objects
must implement, and the API the objects they produce must implement.
Normally, Mail::SpamAssassin uses lazy evaluation where possible, but if you
plan to fork()
or start a new perl interpreter thread to process a message,
this is suboptimal, as each process/thread will have to perform these actions.
Call this function in the master thread or process to perform the actions straightaway, so that the sub-processes will not have to.
If $use_user_prefs
is 0, this will initialise the SpamAssassin
configuration without reading the per-user configuration file and it will
assume that you will call read_scoreonly_config
at a later point.
$use_user_prefs
can
be 0
(do not read user preferences) or 1
(do).
Mail::Audit
Mail::Internet
Net::DNS
See also http://spamassassin.org/ for more information.
Mail::SpamAssassin::Conf
Mail::SpamAssassin::PerMsgStatus
spamassassin
Justin Mason <jm /at/ jmason.org>
SpamAssassin is distributed under Perl's Artistic license.
The latest version of this library is likely to be available from CPAN as well as:
http://spamassassin.org/