2

这是我在这里的第一篇文章,我有点小题大做。我希望通过 spamassainsspamc客户端从 MySQL 数据库中传递文本。我可以通过写入一个文件然后将该文件传递给 spamc 来做到这一点,spamc < 'textfile.txt'但由于磁盘读/写,这很慢。

有谁知道如何直接做到这一点?

4

1 回答 1

1

通过管道以批处理模式将查询回显到命令行客户端,然后将输出通过管道传输到 spamc:

echo "SELECT col1, col2 FROM yourtable" | mysql --batch -uuser -ppassword | spamc

我假设您正在从数据库中选择完整的电子邮件。如果没有,您将收到多个缺少标头的垃圾邮件标志。这是我刚刚运行的一个示例...

X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
        localhost
X-Spam-Flag: YES
X-Spam-Level: *****
X-Spam-Status: Yes, score=5.5 required=5.0 tests=MISSING_DATE,MISSING_FROM,
        MISSING_HEADERS,MISSING_MID,MISSING_SUBJECT,NO_HEADERS_MESSAGE,NO_RECEIVED,
        NO_RELAYS,TVD_SPACE_RATIO autolearn=no version=3.3.1
X-Spam-Report:
        * -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
        *  1.0 MISSING_FROM Missing From: header
        * -0.0 NO_RECEIVED Informational: message has no Received headers
        *  0.0 TVD_SPACE_RATIO TVD_SPACE_RATIO
        *  1.4 MISSING_DATE Missing Date: header
        *  0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822
        *      headers
于 2011-12-01T17:44:32.887 回答