I have set up gmail google app accounts for our own domain, domain.com
, so that email is handled by gmail. I.e. MX records point to google servers, A records to our own server IP. This works fine.
Now I tried sending emails from our machine (via crontab
, using Debian's exim4
) to our own email address, e.g. admin@domain.com
.
This doesn't work. Presumably exim is seeing the address as local and fails to forward it to the google servers. The delivery fails with:
Subject: Mail delivery failed: returning message to sender
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
admin@domain.com
Unrouteable address
and is then unhelpfully delivered to /var/mail
.
Emails to other addresses — outside of domain.com
— work ok.
I looked at the configs under /etc/exim4/conf.d/
but couldn't make sense of it.
Any help is welcome. Cheers!
Best Answer
I solved the problem by creating a new router, inside the
.ifdef DCconfig_internet
block:This forces a remote delivery (via standard dnslookup) even for
*@domain.com
addresses, which is exactly what I wanted.There may be an easier way to achieve this, by modifying the existing routers, but this "works for me".