andrewl85
By:
andrewl85

Why is Postfix able to send emails to other domains but not its own domain?

January 1, 2017 126 views
Email CentOS

I set up an SMTP server on a CentOS 7 droplet. Emails are successfully being sent to Gmail accounts, but they are failing to send to my G Suite email accounts.

Successful email:

Jan 1 13:35:48 Production postfix/smtp[2869]: E5B653FDBA: to=<personal_email_address@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.144.27]:25, delay=877, delays=876/0.02/0.31/0.25, dsn=2.0.0, status=sent (250 2.0.0 OK 1483295748 k58si25466087qta.76 - gsmtp)

Failed email:

Jan 1 13:35:48 Production postfix/lmtp[2871]: E5B653FDBA: to=root@example.com, orig_to=support@example.com, relay=none, delay=876, delays=876/0.02/0.02/0, dsn=4.4.1, status=deferred (connect to example.com[/var/lib/imap/socket/lmtp]: No such file or directory)
Jan 1 13:35:48 Production postfix/smtp[2869]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400d:c0e::1b]:25: Network is unreachable

I replaced my domain name with example.com above.

I was able to fix the "Network is unreachable" by opening /etc/postfix/main.cf and setting the following:

inet_protocols = ipv4

However, the other error is still present, and emails are still failing to send to my domain accounts:

Jan 1 17:22:38 Production postfix/lmtp[4066]: 9EC3E3FE3C: to=root@example.com, orig_to=support@example.com, relay=none, delay=1104, delays=1104/0.03/0.01/0, dsn=4.4.1, status=deferred (connect to example.com[/var/lib/imap/socket/lmtp]: No such file or directory)

Why is Postfix able to send emails to all domains except the one that it's running from? How can this be fixed?

3 Answers

I think I figured it out. I opened /etc/postfix/main.cf file and changed this line:

mydestination = $myhostname, localhost

to:

mydestination = localhost

Then I ran 'service postfix restart' to restart Postfix. It's sending emails to my domain now. Thanks for your help!

Since the hostname of the server matches the domain, it tries to deliver locally instead. Turn it off.

Thanks for responding, but what exactly do I turn off? Are you referring to a certain setting in the main.cf file?

Have another answer? Share your knowledge.