I've got a server on my LAN runnnig exim4 configured to use a smarthost on the WAN like this:
disable_ipv6='true'
dc_eximconfig_configtype='smarthost'
dc_other_hostnames='hostname.mydomain.com'
dc_local_interfaces='127.0.0.1'
dc_readhost='mydomain.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.mydomain.com::587'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool
If I do a hostname -f on this server, I get hostname.mydomain.com. "hostname" isn't in the public DNS for mydomain.com though.
If I send out a test mail using swaks:
swaks --tls --auth --to me@mydomain.com --server smtp.mydomain.com:587
it sends out as username@hostname.mydomain.com, and smtp.mydomain.com says:
<~ 235 2.7.0 Authentication successful
~> MAIL FROM:<username@hostname.mydomain.com>
<~ 250 2.1.0 Ok
~> RCPT TO:<me@mydomain.com>
<~* 450 4.1.8 <username@hostname.mydomain.com>: Sender address rejected: Domain not found
~> QUIT
<~ 221 2.0.0 Bye
But if I try --from username@mydomain.com then it's fine.
Oddly though, if I try using bsd-mailx to send a mail:
mail me@mydomain.com
smtp.mydomain.com rejects it with a different error:
Recipient address rejected: Access denied
I'm not sure what part of the chain is causing the problem. It would seem the easiest fix is to make sure mail is being sent from @mydomain.com rather than @hostname.mydomain.com*, since that's what all other mail clients sending out to that smarthost are doing (on the same domain as the server in question too) - but how?
*Although the recipient address rejected error is weird