I have my own personalised email address which is powered by Google Apps: ericlin at ericlin dot me. I have been receiving emails fine for many years without issues. However, since I setup my own blog server a few year ago, I had never be able to receive any email sent from my host machine via postfix.
I have tried many tests:
– email from cron job
– email from command line using “sendmail”
– email from wordpress
None of them were working. However, if I use normal gmail or ymail address, they all reached destination without issues.
The following were what was logged on my server under /var/log/syslog:
Jun 10 02:45:04 ericlin postfix/cleanup: 2601D43AC3: message-id=<firstname.lastname@example.org> Jun 10 02:45:04 ericlin postfix/qmgr: 2601D43AC3: from=<email@example.com>, size=701, nrcpt=1 (queue active) Jun 10 02:45:04 ericlin postfix/local: 2601D43AC3: to=<ericlin at ericlin dot me>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox) Jun 10 02:45:04 ericlin postfix/qmgr: 2601D43AC3: removed
the logs for working email was following:
Jun 10 03:09:07 ericlin postfix/cleanup: DED8843AC4: message-id=<firstname.lastname@example.org> Jun 10 03:09:07 ericlin postfix/qmgr: DED8843AC4: from=<email@example.com>, size=5170, nrcpt=1 (queue active) Jun 10 03:09:08 ericlin postfix/smtp: DED8843AC4: to=<firstname.lastname@example.org>, relay=smtp.gmail.com[188.8.131.52]:587, delay=0.74, delays=0.02/0.01/0.2/0.51, dsn=2.0.0, status=sent (250 2.0.0 OK 1465528180 18sm2559005qkd.30 - gsmtp) Jun 10 03:09:08 ericlin postfix/qmgr: DED8843AC4: removed
You can see the differences between the two logs were the final message after status=sent, successful one was (250 2.0.0 OK 1465528180 18sm2559005qkd.30 – gsmtp), however, failed one was (delivered to mailbox)
I had been searching for a solution for a long time, but never be able to find a fix.
Today I spent another few hours trying to dig out if I can find anything, finally it is fixed.
The problem is the following line in the postfix’s configuration file /etc/postfix/main.cf, there is a line like below
mydestination = ericlin.me, ip-172-31-50-123.ec2.internal, localhost.ec2.internal, localhost
The problem is that I added my own domain (ericlin.me) to the list, which was wrong. After removing it, issue resolved!! ^_^.
I hope this can help someone with similar problems.