Php 使用spamassassin测试表单输入

Php 使用spamassassin测试表单输入,php,spamassassin,Php,Spamassassin,我在我的电脑上安装了spamassassin,我想用它来测试诸如评论之类的表单输入(我知道spamassassin是用于电子邮件的,但我找不到任何非电子邮件的内容),但当我测试无意义的评论时,spamassassin说它不是垃圾邮件 我正在使用这个库:通过php向spamd发送请求。我是这样测试的: $client = new \Spamassassin\Client(['hostname' => 'localhost']); $messageid = '<' . time() .

我在我的电脑上安装了spamassassin,我想用它来测试诸如评论之类的表单输入(我知道spamassassin是用于电子邮件的,但我找不到任何非电子邮件的内容),但当我测试无意义的评论时,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);

那么,有没有一种方法可以让这项工作做得更好,或者有没有更好的程序来测试非电子邮件垃圾邮件?

如果你想要一个肯定的答案,你必须让你的文本看起来更像垃圾邮件。可以帮助:将字符串
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
粘贴到文本中


虽然spamassassin不是用于此目的的绝对最佳选择,但您可能会发现一些垃圾邮件。您还可以添加您认为应该被捕获为垃圾邮件的内容。

或者是过滤评论等垃圾邮件的选项。付费服务是我们目前的最后手段。您使用过吗?你的经历怎么样?它能抓到垃圾邮件吗?您是否调整/添加了规则以使其更好地工作?我认为添加一个添加http客户端的IP和主机名的
Received:
头可能值得一试,因为这将允许spamassasin根据黑名单检查IP。
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
}