I'm running a mail server with CentOS 6.5 / Exim 4.72 / Dovecot 2.0.9, and have the following problem: when I send emails, from Thunderbird, say from the address me@mydomain.com, the email is delivered with the following headers (extract):
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
You can probably see what it's doing wrong: everywhere it says "me@mydomain.com"@mydomain.com
it should actually be saying me@mydomain.com
. I don't know why it is doing that.
Most recipients accept this anyway, but a few more conservative mail hosts will reject these messages. Replies arrive ok 99% of the time; sometimes they cite my original message as being from: "me@mydomain.com"@mydomain.com On Behalf Of me@mydomain.com
.
I don't think it's Thunderbird, because this is not a problem with other mail servers (i.e., other addresses) from the same client.
From the Exim log (same message):
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
(That second line is a BCC to self.)
As you can see, Exim uses the Dovecot authenticator, and in the log file reports the correct user name at A=dovecot_plain:me@mydomain.com
.
From /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
There are no rewrite rules in exim.conf.
From Dovecot configuration in /etc/dovecot/conf.d/10-auth.conf:
# 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
I did try blanking out auth_default_realm
, but that did not help.
Then to /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
}
And entries in that passdb file look like this:
me@mydomain.com:{SHA512-CRYPT}[~~~]:dovecot:mail::/srv/mail/mydomain.com/me::
(N.B., I edited out the password hash, at [~~~]
.)
And this is where I'm stuck. I don't see Dovecot doing anything wrong (in any case, mail reception and POP/IMAP work fine), so I suspect an error in my Exim configuration.
I imagine I could put together a rewrite rule in Exim to fix the outgoing message headers, but I would rather get to the source of the problem. Any advice?
Sounds like an identical question is answered here (coincidentally, also by me) :