NAME
    Mail::SpamAssassin - Mail::Audit spam detector plugin

SYNOPSIS
      my $mail = Mail::SpamAssassin::MyMailAudit->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
      }
      ...

DESCRIPTION
    Mail::SpamAssassin is a Mail::Audit plugin 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 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.

    SpamAssassin also includes support for reporting spam messages to
    collaborative filtering databases, such as Vipul's Razor (
    http://razor.sourceforge.net/ ).

METHODS
    $f = new Mail::SpamAssassin( [ { opt => val, ... } ] )
        Constructs a new `Mail::SpamAssassin' object. You may pass the
        following attribute-value pairs to the constructor.

        rules_filename
            The filename to load spam-identifying rules from. (optional)

        userprefs_filename
            The filename to load preferences from. (optional)

        config_text
            The text of all rules and preferences. If you prefer not to load
            the rules from files, read them in yourself and set this
            instead. As a result, this will override the settings for
            `rules_filename' and `userprefs_filename'.

        local_tests_only
            If set to 1, no tests that require internet access will be
            performed. (default: 0)

        dont_copy_prefs
            If set to 1, the user preferences file will not be created if it
            doesn't already exist. (default: 0)

        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.

    $status = $f->check ($mail)
        Check a mail, encapsulated in a `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.

    $f->report_as_spam ($mail, $options)
        Report a mail, encapsulated in a `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:

        dont_report_to_razor
            Inhibits reporting of the spam to Razor; useful if you know it's
            already been listed there.

    $f->reply_with_warning ($mail, $replysender)
        Reply to the sender of a mail, encapsulated in a `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.

    $text = $f->remove_spamassassin_markup ($mail)
        Returns the text of the message, with any SpamAssassin-added text
        (such as the report, or X-Spam-Status headers) stripped.

    $f->read_scoreonly_config ($filename)
        Read a configuration file and parse only scores from it. This is
        used to safely allow multi-user daemons to read per-user config
        files without having to use `setuid()'.

    $f->load_scoreonly_sql ($username)
        Read configuration paramaters from SQL database and parse scores
        from it. This will only take effect if the perl `DBI' module is
        installed, and the configuration parameters `user_scores_dsn',
        `user_scores_sql_username', and `user_scores_sql_password' are set
        correctly.

    $f->compile_now ()
        Compile all patterns, load all configuration files, and load all
        possibly-required Perl modules.

        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.

        Note that this will initialise the SpamAssassin configuration
        without reading the per-user configuration file; it assumes that you
        will call `read_scoreonly_config' at a later point.

    $f->create_default_prefs ()
        Copy default prefs file into home directory for later use and
        modification.

PREREQUISITES
    `Mail::Audit' `Mail::Internet'

COREQUISITES
    `Net::DNS'

MORE DOCUMENTATION
    See also http://spamassassin.taint.org/ for more information.

SEE ALSO
    `Mail::SpamAssassin::PerMsgStatus' `spamassassin'

AUTHOR
    Justin Mason <jm /at/ jmason.org>

COPYRIGHT
    SpamAssassin is distributed under Perl's Artistic license.

AVAILABILITY
    The latest version of this library is likely to be available from CPAN
    as well as:

      http://spamassassin.taint.org/

