Mail::SpamAssassin::PerMsgStatus - per-message status |
Mail::SpamAssassin::PerMsgStatus - per-message status (spam or not-spam)
my $spamtest = new Mail::SpamAssassin ({ 'rules_filename' => '/etc/spamassassin.rules', 'userprefs_filename' => $ENV{HOME}.'/.spamassassin.cf' }); my $mail = Mail::SpamAssassin::NoMailAudit->new();
my $status = $spamtest->check ($mail); if ($status->is_spam()) { $status->rewrite_mail (); $mail->accept("caught_spam"); } ...
The Mail::SpamAssassin check()
method returns an object of this
class. This object encapsulates all the per-message state.
The report is returned as a multi-line string, with the lines separated by
\n
characters.
The modifications made are as follows:
*****SPAM*****
(changeable with subject_tag
config option) is
prepended to the subject, unless the rewrite_subject 0
configuration option
is given.
Yes, hits=nn required=nn tests=...
is set in this header to
reflect the filter status. The keys in this string are as follows:
report_header 1
configuration option is given.
YES
.
text/plain
, in order to defang HTML mail or other active
content that could ``call back'' to the spammer.
report_header 1
configuration option is given.
No, hits=nn required=nn tests=...
is set in this header to reflect
the filter status. The keys in this string are the same as for spam mails (see
above).
If the message has been rewritten using rewrite_mail()
, these changes
will be reflected in the string.
Note: this is simply a helper method which calls methods on the mail message object. It is provided because Mail::Audit uses an unusual (ie. not quite intuitive) interface to do this, and it has been a common stumbling block for authors of scripts which use SpamAssassin.
$status
object is finished with, and can be destroyed.
If you are using SpamAssassin in a persistent environment, or checking many mail messages from one the Mail::SpamAssassin manpage factory, this method should be called to ensure Perl's garbage collection will clean up old status objects.
Mail::SpamAssassin
spamassassin
Mail::SpamAssassin::PerMsgStatus - per-message status |