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 anyone@foo.com from somewhere like baz@qux.com and the messages turn up fine on the bar.com server for anyone@foo.com. Likewise, I can send mail from the foo.com VPS to somewhere like baz@qux.com and the messages are received, no problem. Further, I can use SMTP through bar.com using Thunderbird to send messages to anyone@foo.com 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.

Currently /etc/hostname and /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:  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 and 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!


You have to set up manualroute on the foo.com host:

begin routers
    driver = manualroute
    domains = foo.com : qux.com : +local_domains
    route_data = mail.bar.com
    transport = smtp
. . . . .

You have to place it at the very beginning of routers, before any other router. Each message that has destination domain listed in the domains will be sended to the host mail.bar.com. You have to ensure that all that domains are defined as local or properly relayed on the mail.bar.com

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.