我使用以下代码使用 SpamAssassin 生成垃圾邮件报告:
use Mail::SpamAssassin;
my $sa = Mail::SpamAssassin->new();
open FILE, "<", "mail.txt";
my @lines = <FILE>;
my $mail = $sa->parse(@lines);
my $status = $sa->check($mail);
my $report = $status->get_report();
$report =~ s/\n/\n<br>/g;
print "<h1>Spam Report</h1>";
print $report;
$status->finish();
$mail->finish();
$sa->finish();
我遇到的问题是它将“sample-nonspam.txt”归类为垃圾邮件:
Content preview: [...]
Content analysis details: (6.9 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 NO_RELAYS Informational: message was not relayed via SMTP
1.2 MISSING_HEADERS Missing To: header
0.1 MISSING_MID Missing Message-Id: header
1.8 MISSING_SUBJECT Missing Subject: header
2.3 EMPTY_MESSAGE Message appears to have no textual parts and no
Subject: text
-0.0 NO_RECEIVED Informational: message has no Received headers
1.4 MISSING_DATE Missing Date: header
0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822 headers
而该信息 - 是 - 在文件中。让我担心的是,在文档中,它声明“Parse 将返回一个 Mail::SpamAssassin::Message 对象,其中只解析了标头。”。这是否意味着它不会返回完整的消息?