Tuesday, November 20, 2012

Unable to send email to own domain via GMail SMTP using Postfix

I've got Postfix setup on Ubuntu to send emails via GMail SMTP.  Somehow, it doesn't seem to recognize my domain's own users.  Postfix log as follows:

Nov 20 21:40:08 ubuntu postfix/qmgr[12418]: 1EA5A2040813: from=app@mydom.com, size=543, nrcpt=1 (queue active)
Nov 20 21:40:08 ubuntu postfix/local[8895]: 1EA5A2040813: to=app@mydom.com, relay=local, delay=0.14, delays=0.09/0/0/0.06, dsn=5.1.1, status=bounced (unknown user: "app")

The fix is really simple.  Remove or comment the following line in main.cf:

mydestination = $myhostname, $mydomain

Restart Postfix and you're ready to rock :)