External MX Records

I see this particular problem about once or twice a day it seems and probably have for as long as I’ve worked at Rimu.

Sometimes customers opt to have their email handled via a 3rd party mail service (google apps, for example).  If the hostname of your server is example.com and you’re trying to send email/notifications to user@example.com, you’ll likely find that these emails are not being delivered externally.

Postfix will not consult the MX records for a domain that it believes it should be handling itself.  If you look at /etc/postfix/main.cf, you’ll see a line like the following:

mydestination = $myhostname, localhost.$mydomain, localhost

The $myhostname bit of that line will cause email with the same domain as the hostname of the server (unless you’ve explicitly set the myhostname variable to something else) to be delivered locally – thus vanishing.  :)

Simply remove $myhostname, from the line above and restart postfix.  The MX records will be consulted and email should start flowing to that destination.