Unable to send email from host machine to custom email address

Unable to send email from host machine to custom email address

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[12369]: 2601D43AC3: message-id=<0f5e23cef7e94f466eed4183e17476b0@www.ericlin.me>
Jun 10 02:45:04 ericlin postfix/qmgr[30415]: 2601D43AC3: from=<www-data@ericlin.me>, size=701, nrcpt=1 (queue active)
Jun 10 02:45:04 ericlin postfix/local[12375]: 2601D43AC3: to=, 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[30415]: 2601D43AC3: removed
the logs for working email was following:
Jun 10 03:09:07 ericlin postfix/cleanup[12672]: DED8843AC4: message-id=<ed4e377a0fd860e76a4853ae3063452b@www.ericlin.me>
Jun 10 03:09:07 ericlin postfix/qmgr[12614]: DED8843AC4: from=<www-data@ericlin.me>, size=5170, nrcpt=1 (queue active)
Jun 10 03:09:08 ericlin postfix/smtp[12674]: DED8843AC4: to=<someemail@gmail.com>, relay=smtp.gmail.com[]: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[12614]: 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.


Leave a Reply

Your email address will not be published. Required fields are marked *

My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!