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.
check()
After a mail message has been checked, this method can be called. If the score is outside a certain range around the threshold, ie. if the message is judged more-or-less definitely spam or definitely non-spam, it will be fed into SpamAssassin's learning systems (currently the naive Bayesian classifier), so that future similar mails will be caught.
After a mail message has been checked, this method can be called. It will return 1 for mail determined likely to be spam, 0 if it does not seem spam-like.
After a mail message has been checked, this method can be called. It will return a comma-separated string, listing all the symbolic test names of the tests which were trigged by the mail.
After a mail message has been checked, this method can be called. It will return a comma-separated string, listing all the symbolic test names of the meta-rule sub-tests which were trigged by the mail. Sub-tests are the normally-hidden rules, which score 0 and have names beginning with two underscores, used in meta rules.
After a mail message has been checked, this method can be called. It will return the number of hits this message incurred.
After a mail message has been checked, this method can be called. It will return the number of hits required for a mail to be considered spam.
Deliver a "spam report" on the checked mail message. This contains details of how many spam detection rules it triggered.
The report is returned as a multi-line string, with the lines separated by \n characters.
\n
Give a "preview" of the content.
This is returned as a multi-line string, with the lines separated by \n characters, containing a fully-decoded, safe, plain-text sample of the first few lines of the message body.
Rewrite the mail message. This will at minimum add headers, and at maximum MIME-encapsulate the message text, to reflect its spam or not-spam status.
The possible modifications are as follows:
The string *****SPAM***** (changeable with subject_tag config option) is prepended to the subject, unless the rewrite_subject 0 configuration option is given.
*****SPAM*****
subject_tag
rewrite_subject 0
A string, Yes, hits=nn required=nn tests=... is set in this header to reflect the filter status. The keys in this string are as follows:
Yes, hits=nn required=nn tests=...
A string, 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).
No, hits=nn required=nn tests=...
Set to YES.
YES
Set to the version number of the SpamAssassin checker which tested the mail.
If report_safe is set to true (1), then spam messages are encapsulated into their own message/rfc822 MIME attachment without any modifications being made.
If report_safe is set to false (0), then the message will only have the above headers added/modified.
Returns the mail message as a string, including headers and raw body text.
If the message has been rewritten using rewrite_mail(), these changes will be reflected in the string.
rewrite_mail()
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.
Indicate that this $status object is finished with, and can be destroyed.
$status
If you are using SpamAssassin in a persistent environment, or checking many mail messages from one Mail::SpamAssassin factory, this method should be called to ensure Perl's garbage collection will clean up old status objects.
Mail::SpamAssassin spamassassin
Mail::SpamAssassin
spamassassin
To install Mail::SpamAssassin::SpamCopURI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::SpamAssassin::SpamCopURI
CPAN shell
perl -MCPAN -e shell install Mail::SpamAssassin::SpamCopURI
For more information on module installation, please visit the detailed CPAN module installation guide.