I'm setting up an Exim 4.87 mailserver with virtual domains stored in a MySQL database. The machine has a hostname of athena.example.com
(the example.com of course being fictuous). I want to be able to send as user@example.com.
Local delivery to these virtual users works, so I know the tables are read properly. I added this to my /etc/exim/config:
domainlist local_domains = @:localhost:${lookup mysql{SELECT domain FROM domains WHERE type='local' AND domain='${quote_mysql:${domain}}'}}
..as seen in many examples.
+------------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------------+------+-----+---------+-------+
| domain | char(128) | NO | MUL | | |
| type | enum('local','relay') | NO | | local | |
| relay_host | char(128) | NO | | | |
+------------+-----------------------+------+-----+---------+-------+
Now, when sending mail to a remote host, something odd happens:
$ /usr/lib/sendmail jvo@my.real.domain
Subject: Test 1
foo
.
Log:
2016-08-21 00:56:41 1bbFBm-0005ZL-0D <= jvo@athena.example.com U=jeroen P=local S=382
2016-08-21 00:56:43 1bbFBm-0005ZL-0D => jvo@my.real.domain R=dnslookup T=remote_smtp H=mx3.xs4all.nl [194.109.24.134] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 2.0.0 mxdrop302.xs4all.net accepted message u7KMuf8f017179"
2016-08-21 00:56:43 1bbFBm-0005ZL-0D Completed
This gets delivered with a From: of jvo@athena.example.com
, as is to be expected.
$ /usr/lib/sendmail jvo@my.real.domain
Subject: Test 2
From: jvo@example.com
foo
.
Log (similar to the first one)
2016-08-21 00:57:32 1bbFCT-0005ZT-O5 <= jvo@athena.example.com U=jeroen P=local S=427
2016-08-21 00:57:35 1bbFCT-0005ZT-O5 => jvo@my.real.domain R=dnslookup T=remote_smtp H=mx1.xs4all.nl [194.109.24.132] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 2.0.0 mxdrop301.xs4all.net accepted message u7KMvW6N012011"
2016-08-21 00:57:35 1bbFCT-0005ZT-O5 Completed
This gets delivered with a From: of jvo@example.com
, without the 'athena' part. So far so good.
Now, when I try to send mail using authenticated SMTP, the FQDN gets added to the mail! The end result is
"jvo@example.com"@athena.example.com
which of course gets rejected. The quotes are added as well (and yes, it is correctly set in my mail client).
Log:
2016-08-21 00:38:27 1bbEuJ-0005Yb-S0 <= "jvo@example.com"@athena.example.com H=([IPv6:2001:xx:yy:zz]) [2001:xx:yy:zz] P=esmtpsa X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=no A=plain:jvo@example.com S=2822 id=57B8DBE3.9060504@example.com
2016-08-21 00:38:29 1bbEuJ-0005Yb-S0 ** jvo@my.real.domain R=dnslookup T=remote_smtp H=mx2.xs4all.nl [194.109.24.138] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes: SMTP error from remote mail server after RCPT TO:<jvo@my.real.domain>: 554 5.7.1 invalid routing in sender address <"jvo@example.com"@athena.example.com>
2016-08-21 00:38:29 1bbEuL-0005Yi-HO <= <> R=1bbEuJ-0005Yb-S0 U=exim P=local S=4489
2016-08-21 00:38:29 1bbEuJ-0005Yb-S0 Completed
2016-08-21 00:38:29 1bbEuL-0005Yi-HO ** jvo@example.com@athena.example.com <"jvo@example.com"@athena.example.com>: Unrouteable address
2016-08-21 00:38:29 1bbEuL-0005Yi-HO Frozen (delivery error message)
So at the moment I'm stuck... any idea what could be wrong?