![Dovecot 反垃圾邮件插件未触发](https://linux22.com/image/654871/Dovecot%20%E5%8F%8D%E5%9E%83%E5%9C%BE%E9%82%AE%E4%BB%B6%E6%8F%92%E4%BB%B6%E6%9C%AA%E8%A7%A6%E5%8F%91.png)
我在使用 dovecot 2.1.7 和 dspam 3.10.1 的反垃圾邮件插件时遇到了问题。
我认为反垃圾邮件插件无法识别垃圾文件夹,因为日志报告
Mar 25 13:11:22 mail imap: antispam: mailbox_is_spam(Junk): 0
在用 Google 找到很少的结果后,我很确定输出应该是
mailbox_is_spam(垃圾邮件):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
并不表明已经进行过任何培训。
谢谢你的帮助,拉尔夫
答案1
好的,我的设置有两个错误配置。
首先
我的虚拟用户收件箱位于
/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