So. There's two servers---foo.com which is a VPS, and bar.com which is a shared host running cPanel and has been configured to accept mail for foo.com.
foo.com has a fresh install of Debian 7 and Exim4 running. The MX record for foo.com points to bar.com in the DNS.
I don't want to accept mail locally at foo.com VPS and so want to continue using the addresses for foo.com set up at bar.com, which seems to work fine insofar as I can send messages to firstname.lastname@example.org from somewhere like email@example.com and the messages turn up fine on the bar.com server for firstname.lastname@example.org. Likewise, I can send mail from the foo.com VPS to somewhere like email@example.com and the messages are received, no problem. Further, I can use SMTP through bar.com using Thunderbird to send messages to firstname.lastname@example.org and they turn up fine on the bar.com server. So looks like MX record works as far as I can tell.
The problem is though, sending mail from foo.com VPS to a foo.com address --- the mail never gets delivered. Not locally, and not to bar.com where it should go. It just kind of disappears into some void---no errors in /var/log/mail* etc, no emails bouncing back, but the messages never arrive at bar.com host.
/etc/mailname files on foo.com VPS have the entry "mailclient.foo.com" in them to avoid sending the mail locally.
And the localhost entry in
/etc/hosts on foo.com is similarly set to mailclient.foo.com:
127.0.0.1 localhost mailclient.foo.com
The config for Exim4 is pretty much a default 'Internet site' config, except that the system mail name is set to mailclient.foo.com to avoid sending emails locally.
hostname command returns: mailclient.foo.com
hostname -f command returns: localhost
I'm new to mail in general, let alone Exim4 config, so there's bound to be something (or indeed a few things!) that I've done wrong...
Any ideas/leads/something to try/read?
Any and all help greatly appreciated! I've been stuck on this for weeks!