我用Spamassassin用筛子安装后缀。垃圾邮件杀手会将电子邮件标记为垃圾邮件。
我正试图让筛子把被SpamAssassin标记为“垃圾邮件”的邮件移动到垃圾文件夹中。然而,它并没有这样做。我不知道自己做错了什么,很沮丧。
这是我的dovecot.conf转储:
$ dovecot -n
# 2.2.9: /etc/dovecot/dovecot.conf
# OS: Linux 3.13.0-37-generic x86_64 Linux Mint 17.1 Rebecca ext4
info_log_path = /var/log/dovecot-info.log
log_path = /var/log/dovecot.log
mail_location = maildir:/var/mail/vmail/%u
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace {
inbox = yes
location =
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
prefix =
separator = /
type = private
}
passdb {
args = scheme=plain /etc/dovecot/passwd
driver = passwd-file
}
plugin {
sieve = ~/.dovecot.sieve
sieve_before = /etc/dovecot/sieve/sieve.default
sieve_default = /etc/dovecot/sieve/sieve.default
sieve_dir = ~/sieve
sieve_global_dir = /var/lib/dovecot/sieve/
}
protocols = imap lmtp sieve
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
user = postfix
}
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
inet_listener sieve_deprecated {
port = 2000
}
process_min_avail = 0
service_count = 1
vsz_limit = 64 M
}
service managesieve {
process_limit = 1024
}
ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key
userdb {
args = uid=vmail gid=vmail home=/home/vmail/%u
driver = static
}
protocol lda {
mail_plugins = " sieve"
}
protocol lmtp {
mail_plugins = " sieve"
}
protocol sieve {
mail_max_userip_connections = 10
mail_plugins =
managesieve_implementation_string = Dovecot Pigeonhole
managesieve_logout_format = bytes=%i/%o
managesieve_max_compile_errors = 5
managesieve_max_line_length = 65536
managesieve_notify_capability =
managesieve_sieve_capability =
}我的/etc/dovecot/ the /sieve.default是以下内容:
$ cat /etc/dovecot/sieve/sieve.default
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
}“垃圾”文件夹存在。以下是电子邮件的转储:
From user@domain.tld Mon May 11 14:37:44 2015
Return-Path: <user@domain.tld>
X-Original-To: user@testmail.domain.tld
Delivered-To: user@testmail.domain.tld
Received: by Linux-Mint (Postfix, from userid 5001)
id A59ECE34D1; Mon, 11 May 2015 14:37:44 -0400 (EDT)
Received: from localhost by Linux-Mint
with SpamAssassin (version 3.4.0);
Mon, 11 May 2015 14:37:44 -0400
From: User <user@domain.tld>
To: user@testmail.domain.tld
Subject: *****SPAM***** This is Junk Mail
Date: Mon, 11 May 2015 14:37:38 -0400
Message-Id: <20150511183738.GD7930@user-pc>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on Linux-Mint
X-Spam-Flag: YES
X-Spam-Level: **************************************************
X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE autolearn=no
autolearn_force=no version=3.4.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_5550F6F8.2DF3E67D"
Status: RO
Content-Length: 1867
Lines: 52
This is a multi-part message in MIME format.
------------=_5550F6F8.2DF3E67D
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Spam detection software, running on the system "Linux-Mint",
has identified this incoming email as possible spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
@@CONTACT_ADDRESS@@ for details.
Content preview: GTUBE string: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
[...]
Content analysis details: (1000.0 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
------------=_5550F6F8.2DF3E67D
Content-Type: message/rfc822; x-spam-type=original
Content-Description: original message before SpamAssassin
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Received: from domain.tld (my-hostname.domain.tld [IPv6:REMOVED])
by Linux-Mint (Postfix) with ESMTPS id 0A6A2E34BF
for <user@testmail.domain.tld>; Mon, 11 May 2015 14:37:40 -0400 (EDT)
Received: from user-pc (unknown [IPv6:2001:470:8:209::c0ff:ee])
by domain.tld (Postfix) with ESMTPSA id 03FD41028E
for <user@testmail.domain.tld>; Mon, 11 May 2015 18:37:40 +0000 (UTC)
Date: Mon, 11 May 2015 14:37:38 -0400
From: User <user@domain.tld>
To: user@testmail.domain.tld
Subject: This is Junk Mail
Message-ID: <20150511183738.GD7930@user-pc>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
GTUBE string:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
------------=_5550F6F8.2DF3E67D--我正在测试这封邮件从一个服务器到另一个服务器,发送者和接收者不是同一台机器。接收者是user@testmail.domain.tld,发送者是user@domain.tld。电子邮件显然被标记为垃圾邮件。
为什么不将电子邮件移动到垃圾文件夹中?
发布于 2015-05-13 03:56:06
弄明白了。由于我仍然是个菜鸟,我的回答可能不是最好的,但我希望它能帮助到外面的人。
这有一些问题,但主要是postfix并没有路由邮件到dovecot进行传递。Dovecot+sieve完全被绕过。
为了解决这个问题,我必须让Postfix和Dovecot通过lmtp进行通信。首先,我安装了dovecot:
protocol lda {
mail_plugins = $mail_plugins sieve
}
protocol lmtp {
mail_plugins = $mail_plugins sieve
}
service lmtp {
inet_listener lmtp {
address = 127.0.0.1 ::1
port = 10025
}
}然后我不得不让后缀和多维柯谈谈。我这么做是为了:
virtual_transport = lmtp:[::1]:10025然后回到多维柯,我必须正确地配置筛子。
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
sieve_before = /etc/dovecot/sieve/sieve.default
sieve_default = /etc/dovecot/sieve/sieve.default
sieve_global_dir = /var/lib/dovecot/sieve/
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
service_count = 1
process_min_avail = 0
vsz_limit = 64M
}
service managesieve {
process_limit = 1024
}
protocol sieve {
managesieve_max_line_length = 65536
mail_max_userip_connections = 10
# Space separated list of plugins to load (none known to be useful so far).
# Do NOT try to load IMAP plugins here.
mail_plugins =
managesieve_logout_format = bytes=%i/%o
managesieve_implementation_string = Dovecot Pigeonhole
managesieve_sieve_capability =
managesieve_notify_capability =
managesieve_max_compile_errors = 5
}从这里开始,我在/etc/dovecot/ case /sieve.default中加入了标准的spamassassin规则,在我的例子中,这是:
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
}之后,我跑了:
sievec /etc/dovecot/sieve/sieve.default这个“汇编”了筛子的规则。最后,我重新开始了多维柯和后缀。
sudo service dovecot restart
sudo service postfix restart在此基础上,我给自己发送了一个测试垃圾邮件,并将其重定向到垃圾邮件文件夹。我希望这会有所帮助,并请你原谅并纠正我可能犯的错误。
https://stackoverflow.com/questions/30175366
复制相似问题