Dovecot

Dovecot 反垃圾郵件外掛不會被觸發

  • March 27, 2015

我遇到了使用 dovecot 2.1.7 和 dspam 3.10.1 的反垃圾郵件外掛的問題。

我認為,反垃圾郵件外掛無法辨識垃圾文件夾,因為日誌報告

Mar 25 13:11:22 mail imap: antispam: mailbox_is_spam(Junk): 0

在用Google找到很少的結果後,我很確定,輸出應該是

郵箱是垃圾郵件(垃圾郵件):1

dovecot 反垃圾郵件配置如下:

protocol imap {
 mail_plugins = $mail_plugins antispam
}


plugin {
 antispam_debug_target = stdout
 antispam_verbose_debug = 1

 antispam_backend = dspam
 antispam_signature = X-DSPAM-Signature
 antispam_signature_missing = error

 antispam_trash = Trash
 antispam_spam = Junk

 antispam_dspam_binary = /usr/bin/dspam
 antispam_dspam_args = --client;--user=%u;--source=error
}

當使用 Thunderbird 手動將消息移動到垃圾文件夾時,會發生這種情況:

Mar 25 13:24:22 mail imap: antispam: mailbox_is_unsure(Junk): 0
Mar 25 13:24:22 mail imap: antispam: mailbox_is_trash(INBOX): 0
Mar 25 13:24:22 mail imap: antispam: mailbox_is_trash(Junk): 0
Mar 25 13:24:22 mail imap: antispam: mail copy: from trash: 0, to trash: 0
Mar 25 13:24:22 mail imap: antispam: mailbox_is_spam(INBOX): 0
Mar 25 13:24:22 mail imap: antispam: mailbox_is_spam(Junk): 0
Mar 25 13:24:22 mail imap: antispam: mailbox_is_unsure(INBOX): 0
Mar 25 13:24:22 mail imap: antispam: mail copy: src spam: 0, dst spam: 0, src unsure: 0

Mar 25 13:24:31 mail imap: antispam: plugin initialising (2.0-notgit)
Mar 25 13:24:31 mail imap: antispam: verbose debug enabled
Mar 25 13:24:31 mail imap: antispam: "Junk" is exact match spam folder
Mar 25 13:24:31 mail imap: antispam: no unsure folders
Mar 25 13:24:31 mail imap: antispam: "Trash" is exact match trash folder
Mar 25 13:24:31 mail imap: antispam: dspam binary set to /usr/bin/dspam
Mar 25 13:24:31 mail imap: antispam: dspam extra arg --client
Mar 25 13:24:31 mail imap: antispam: dspam extra arg --user=vmail
Mar 25 13:24:31 mail imap: antispam: dspam extra arg --source=error
Mar 25 13:24:31 mail imap: antispam: signature header line is "X-DSPAM-Signature"

但是檢查dspam_stats並不意味著已經完成了任何培訓。

謝謝你的幫助,拉爾夫

好的,我的設置中有兩個錯誤配置。

首先

我的虛擬使用者收件箱位於

/var/mail/vhosts/<domain>/<username>

不是

/var/mail/vhosts/<domain>/<username>/.INBOX

垃圾文件夾位置是

/var/mail/vhosts/<domain>/<username>/.Junk

但是(或為此) IMAP 命名空間 INBOX 指向

/var/mail/vhosts/<domain>/<username>/.INBOX

我的配置必須是

antispam_spam = INBOX/Junk

第二個錯誤配置實際上與問題無關,但無論如何我都會發布答案:

dspam命令參數是--user <username>和不是--user=<username>(等號是錯誤的),因此配置必須是:

antispam_dspam_args = --client;--source=error;--user;%u

代替

antispam_dspam_args = --client;--user=%u;--source=error

引用自:https://serverfault.com/questions/678138