我的计算机上安装了spamassassin,我想用它来测试表单输入,比如评论(我知道spamassassin是用于电子邮件的,但我找不到任何非电子邮件的东西),但当我测试一条胡言乱语的评论时,spamassassin说它不是垃圾邮件。
我使用这个库:https://github.com/templateria/php-spamassassin通过php向spamd发送请求。我是这样测试的:
$client = new \Spamassassin\Client(['hostname' => 'localhost']);
$messageid = '<' . time() .'-' . md5('test@gamesmart.com' . 'test@gamesmart.com') . '@' . $_SERVER['SERVER_NAME'] . '>';
$message = "To: test@gamesmart.com\r\n";
$message .= "From: test@gamesmart.com\r\n";
$message .= "Date: " . date("r") . "\r\n";
$message .= "Message-ID: " . $messageid . "\r\n";
$message .= "Subject: Spamassassin Comment Check\r\n\r\n";
$message .= "asdfa sadf sadf af saf s";
$results = $client->getSpamReport($message);
dd($results);laravel的数据转储显示如下所示:
Result {#209 ▼
+protocolVersion: "1.1"
+responseCode: "0"
+responseMessage: "EX_OK\r"
+contentLength: "660"
+score: -0.0
+thresold: 5.0
+isSpam: false
+message: """
Spam detection software, running on the system "A1188",\n
has NOT identified this incoming email as spam. The original\n
message has been attached to this so you can view it or label\n
similar future email. If you have any questions, see\n
the administrator of that system for details.\n
\n
Content preview: asdfa sadf sadf af saf s [...] \n
\n
Content analysis details: (-0.0 points, 5.0 required)\n
\n
pts rule name description\n
---- ---------------------- --------------------------------------------------\n
-0.0 NO_RELAYS Informational: message was not relayed via SMTP\n
-0.0 NO_RECEIVED Informational: message has no Received headers
"""
+headers: """
SPAMD/1.1 0 EX_OK\r\n
Content-length: 660\r\n
Spam: False ; -0.0 / 5.0
"""
+didSet: false
+didRemove: false
}那么,有没有办法让它更好地工作,或者有没有更好的程序来测试非电子邮件垃圾邮件?
发布于 2016-03-08 04:33:35
如果你想要一个肯定的结果,你必须让你的文本看起来更像垃圾邮件。GTUBE可以提供帮助:将字符串XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X插入文本中。
虽然spamassassin不是最好的解决方案,但您可能会捕获一些垃圾邮件。你也可以通过augment the spamassassin ruleset来添加你认为应该被当作垃圾邮件捕获的东西。
https://stackoverflow.com/questions/35639946
复制相似问题