Exim(Dovecot身份验证器)格式错误的发件人地址:" user @ domain" @domain(应该是:user @ domain)

时间:2014-10-30 14:00:25

标签: smtp exim dovecot

我使用CentOS 6.5 / Exim 4.72 / Dovecot 2.0.9运行邮件服务器,并且遇到以下问题:当我从Thunderbird发送电子邮件时,请发送电子邮件地址为me@mydomain.com,电子邮件随附以下标题(摘录):

Return-path: <"me@mydomain.com"@mydomain.com>
Envelope-to: me@mydomain.com
...
Received: from host86-128-154-245.range86-128.btcentralplus.com ([86.128.154.245] helo=asus-i7.banchory)
  by mail.mydomain.com with esmtpsa (UNKNOWN:AES128-SHA:128)
  (Exim 4.72)
  (envelope-from <"me@mydomain.com"@mydomain.com>)
  id 1Xjdoz-0005Zt-7M; Thu, 30 Oct 2014 01:42:37 +0100
Message-ID: <54518978.6010305@mydomain.com>
...
From: Kalenz <me@mydomain.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0
...
Sender: "me@mydomain.com"@mydomain.com

你可能会看到它做错了什么:它所说的"me@mydomain.com"@mydomain.com实际上应该说me@mydomain.com。我不知道为什么会这样做。

无论如何,大多数收件人都会接受此邮件,但是一些更保守的邮件主机会拒绝这些邮件。回复99%的时间到达;有时他们会将我原来的消息称为来自:"me@mydomain.com"@mydomain.com On Behalf Of me@mydomain.com

我不认为它是Thunderbird,因为这不是来自同一客户端的其他邮件服务器(即其他地址)的问题。

从Exim日志(相同的消息):

2014-10-30 01:42:37 1Xjdoz-0005Zt-7M <= "me@mydomain.com"@mydomain.com H=host86-128-154-245.range86-128.btcentralplus.com (asus-i7.banchory) [86.128.154.245] P=esmtpsa X=UNKNOWN:AES128-SHA:128 A=dovecot_plain:me@mydomain.com S=30908 id=54518978.6010305@mydomain.com
2014-10-30 01:42:38 1Xjdoz-0005Zt-7M => me <me@mydomain.com> R=dovecot_virtual_router T=dovecot_virtual_transport
2014-10-30 01:42:38 1Xjdoz-0005Zt-7M => otherguy@hisdomain.com <otherguy@hisdomain.com> R=dnslookup T=remote_smtp H=mail.hisdomain.com [12.34.56.78] X=TLSv1:DHE-RSA-AES256-SHA:256
2014-10-30 01:42:38 1Xjdoz-0005Zt-7M Completed

(第二行是自我BCC。)

如您所见,Exim使用Dovecot身份验证器,并在日志文件中报告A=dovecot_plain:me@mydomain.com处的正确用户名。

来自/etc/exim.conf:

# Host's fully qualified canonical name
primary_hostname = mail.mydomain.com

# Our own mail domains:
domainlist local_domains = @ : localhost : localhost.localdomain : mydomain.com : otherdomain.com

# The domain to add to all unqualified addresses (defaults to primary_hostname):
qualify_domain = mydomain.com

...
# Dovecot authenticators ref. http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_dovecot_authenticator.html
dovecot_plain:
  driver = dovecot
  public_name = PLAIN
  server_socket = /var/run/dovecot/auth-client
  server_set_id = $auth1

exim.conf中没有重写规则。

来自/etc/dovecot/conf.d/10-auth.conf中的Dovecot配置:

# Default realm/domain to use if none was specified.
# This is used for both SASL realms and appending @domain to username in plaintext logins.
auth_default_realm = mydomain.com

# Space separated list of wanted authentication mechanisms:
#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey gss-spnego
auth_mechanisms = plain

...

#!include auth-deny.conf.ext
#!include auth-master.conf.ext
#!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext

我确实尝试消除auth_default_realm,但这没有帮助。

然后到/etc/dovecot/conf.d/auth-passwdfile.conf.ext:

# cat auth-passwdfile.conf.ext
# Authentication for passwd-file users. Included from auth.conf.
# Note: if the user logs in as "billy@domain.com", then %u="billy@domain.com" and %n="billy".

passdb {
  driver = passwd-file
  args = username_format=%u /path/to/passdb
}

userdb {
  driver = passwd-file
  args = username_format=%u /path/to/passdb
}

该passdb文件中的条目如下所示:

me@mydomain.com:{SHA512-CRYPT}[~~~]:dovecot:mail::/srv/mail/mydomain.com/me::

(N.B。,我在[~~~]编辑了密码哈希。)

这就是我被困的地方。我没有看到Dovecot做错任何事(无论如何,邮件接收和POP / IMAP工作正常),所以我怀疑我的Exim配置出错了。

我想我可以在Exim中组合一个重写规则来修复传出的邮件头,但我宁愿找到问题的根源。有什么建议吗?