{
    "mode": "perldoc",
    "parameter": "Mail::Box::Search::SpamAssassin",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3ABox%3A%3ASearch%3A%3ASpamAssassin/json",
    "generated": "2026-06-16T10:21:08Z",
    "synopsis": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\nmy $spam = Mail::Box::Search::SpamAssassin->new;\nif($spam->search($message)) {...}\nmy @msgs   = $filter->search($folder);\nforeach my $msg ($folder->messages)\n{   $msg->delete if $msg->label('spam');\n}\nmy $spam2 = Mail::Box::Search::SpamAssassin\n->new(deliver => 'DELETE');\n$spam2->search($folder);\n$mgr->moveMessages($spamfolder, $folder->messages('spam'));",
    "sections": {
        "NAME": {
            "content": "Mail::Box::Search::SpamAssassin - select spam messages with Mail::SpamAssassin\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Box::Search::SpamAssassin\nis a Mail::Box::Search\nis a Mail::Reporter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Mail::Box::Manager;\nmy $mgr    = Mail::Box::Manager->new;\nmy $folder = $mgr->open('Inbox');\n\nmy $spam = Mail::Box::Search::SpamAssassin->new;\nif($spam->search($message)) {...}\n\nmy @msgs   = $filter->search($folder);\nforeach my $msg ($folder->messages)\n{   $msg->delete if $msg->label('spam');\n}\n\nmy $spam2 = Mail::Box::Search::SpamAssassin\n->new(deliver => 'DELETE');\n$spam2->search($folder);\n$mgr->moveMessages($spamfolder, $folder->messages('spam'));\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "*Spam* means \"unsollicited e-mail\", and is as name derived from a Monty Python scatch. Although\nMonty Python is fun, spam is a pain: it needlessly spoils minutes of time from most people:\ntelephone bills, overful mailboxes which block honest e-mail, and accidentally removal of honest\ne-mail which looks like spam. Spam is the pest of Internet.\n\nHappily, Mail::Box can be used as spam filter, in combination with the useful Mail::SpamAssassin\nmodule (which must be installed separately). Each message which is searched is wrapped in a\nMail::Message::Wrapper::SpamAssassin object.\n\nThe spam-assassin module version 2 is not really well adapted for Mail::Message objects, which\nwill make this search even slower than spam-detection already is.\n\nExtends \"DESCRIPTION\" in Mail::Box::Search.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Box::Search.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Box::Search.\n\nMail::Box::Search::SpamAssassin->new(%options)\nCreate a spam filter. Internally, a Mail::SpamAssassin object is maintained.\n\nOnly the whole message can be searched; this is a limitation of the Mail::SpamAssassin\nmodule.\n\n-Option       --Defined in       --Default\nbinaries       Mail::Box::Search  <false>\ndecode         Mail::Box::Search  <true>\ndelayed        Mail::Box::Search  <true>\ndeleted        Mail::Box::Search  <false>\ndeliver        Mail::Box::Search  undef\nin             Mail::Box::Search  'MESSAGE'\nlabel                             c<'spam'>\nlimit          Mail::Box::Search  0\nlog            Mail::Reporter     'WARNINGS'\nlogical        Mail::Box::Search  'REPLACE'\nmultiparts     Mail::Box::Search  <true>\nrewritemail                      <true>\nsaoptions                        { }\nspamassassin                     undef\ntrace          Mail::Reporter     'WARNINGS'\n\nbinaries => BOOLEAN\ndecode => BOOLEAN\ndelayed => BOOLEAN\ndeleted => BOOLEAN\ndeliver => undef|CODE|'DELETE'\nin => 'HEAD'|'BODY'|'MESSAGE'\nlabel => STRING|undef\nMark all selected message with the specified STRING. If this option is explicitly set to\n\"undef\", the label will not be set.\n\nlimit => NUMBER\nlog => LEVEL\nlogical => 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'\nmultiparts => BOOLEAN\nrewritemail => BOOLEAN\nAdd lines to the message header describing the results of the spam scan. See\nMail::SpamAssassin::PerMsgStatus subroutine rewritemail.\n\nsaoptions => HASH\nOptions to create the internal Mail::SpamAssassin object; see its manual page for the\navailable options. Other setting may be provided via SpamAssassins configuration file\nmechanism, which is explained in Mail::SpamAssassin::Conf.\n\nspamassassin => OBJECT\nProvide a Mail::SpamAssassin object to be used for searching spam. If none is specified,\none is created internally. The object can be retrieved with assassinator().\n\ntrace => LEVEL\n\nexample:\n\nmy $filter = Mail::Box::Search::SpamAssassin\n->new( found => 'DELETE' );\n"
                },
                {
                    "name": "Searching",
                    "content": "Extends \"Searching\" in Mail::Box::Search.\n\n$obj->assassinator()\nReturns the internally maintained assassinator object. You may want to reach this object for\ncomplex configuration.\n\n$obj->inBody($part, $body)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->inHead($part, $head)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->search($folder|$thread|$message|ARRAY)\nInherited, see \"Searching\" in Mail::Box::Search\n\n$obj->searchPart($part)\nInherited, see \"Searching\" in Mail::Box::Search\n"
                },
                {
                    "name": "The Results",
                    "content": "Extends \"The Results\" in Mail::Box::Search.\n\n$obj->printMatch( [$fh], HASH )\nInherited, see \"The Results\" in Mail::Box::Search\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Box::Search.\n\n$obj->AUTOLOAD()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Box::Search::SpamAssassin->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,\n$callback] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Box::Search::SpamAssassin->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Search::SpamAssassin->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Box::Search.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Error: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "This module is part of Mail-Box distribution version 3.009, built on August 18, 2020. Website:\nhttp://perl.overmeer.net/CPAN/\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Mail::Box::Search::SpamAssassin - select spam messages with Mail::SpamAssassin",
    "flags": [],
    "examples": [],
    "see_also": []
}