使用spamassassin测试表单输入

时间:2016-02-25 22:46:24

标签: php spamassassin

我的计算机上安装了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
}

那么,有没有办法让这项工作更好,或者是否有更好的程序来测试非电子邮件垃圾邮件?

1 个答案:

答案 0 :(得分:1)

如果你想要积极的,你必须使你的文字看起来更像垃圾邮件。 GTUBE可以提供帮助:将字符串XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X粘贴到您的文字中。

虽然spamassassin不是最适合使用的东西,但你可能会捕捉到一些垃圾邮件。您还可以augment the spamassassin ruleset添加您认为应该被视为垃圾邮件的内容。