NAME

Mail::SpamAssassin::SimpleClient - easy client to SpamAssassin's spamd

VERSION

version 0.101610

WARNING

Achtung!

This module is still in its infancy. Its interface will probably change somewhat, especially if some changes are made to the spamd protocol to make this module awesomer. Please don't rely on it. Just play with it and try to help figure out how to make it great.

SYNOPSIS

my $spamc = Mail::SpamAssassin::Simpleclient->new;

die "It's horrible, horrible spam!" if $spamc->check($message)->is_spam;

DESCRIPTION

Mail::SpamAssassin is a great, free tool for identifying spam messages. It is generally accessed via the spamc or spamassassin programs. Despite the fact that SpamAssassin in implemented in Perl, it is often difficult to check a message against SpamAssassin from within a Perl program.

This module provides a very simple (but also limited) interface to check mail against SpamAssassin.

METHODS

new

my $client = Mail::SpamAssassin::SimpleClient->new(\%arg);

This method returns a new SimpleClient object.

Valid arguments are:

host     - the host on which to look for spamd (default: localhost)
port     - the port on which to look for spamd (default: 783)
username - username to pass to spamd
timeout  - how long (in seconds) to allow SpamAssassin to consider the
           message before an exception is raised; default 120;  set to 0 to
           wait forever

check

my $result = $spamc->check($message);

This method passes a message to SpamAssassin to be spam-checked. It returns a Mail::SpamAssassin::SimpleClient::Result object. If SpamAssassin does not respond within the SimpleClient's timeout period, an exception is raised.

TODO

Support spamd-less operation.

Get the protocol to support "always rewrite" or another way to always get scores.

AUTHOR

Ricardo Signes <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Ricardo Signes.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.