Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I solved the problem by creating a new router, inside the .ifdef DCconfig_internet block:

my_domain:
  debug_print = "R: dnslookup for $local_part@$domain"
  driver = dnslookup
  domains = domain.com
  transport = remote_smtp
  # ignore private rfc1918 and APIPA addresses
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\
                        172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :\
                        255.255.255.255
  no_more

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".

share|improve this answer
add comment

The domain domain.com is invalid or has a bad DNS setup. It could even resolve to an IP in private address space. As you redacted the real domain, there is no much more information we can provide.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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