andrewl85
By:
andrewl85

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

January 1, 2017 392 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?

4 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?

Hi,

I still have the same problem as in topic. But my GMAIL answer is:

Apr 15 10:59:31 server postfix/pickup[14501]: 841DDC0A50: uid=0 from=<root>
Apr 15 10:59:31 server postfix/cleanup[14853]: 841DDC0A50: message-id=<20170415075931.841DDC0A50@MYDOMAIN.COM>
Apr 15 10:59:31 server opendkim[20771]: 841DDC0A50: DKIM-Signature field added (s=SERVER, d=MYDOMAIN.COM)
Apr 15 10:59:31 server postfix/qmgr[14502]: 841DDC0A50: from=<root@MYDOMAIN.COM>, size=457, nrcpt=1 (queue active)
Apr 15 10:59:31 server postfix/smtp[14846]: 841DDC0A50: host ASPMX.L.GOOGLE.COM[173.194.79.27] said: 450-4.2.1 The user you are trying to contact is receiving mail at a rate that 450-4.2.1 prevents additional messages from being delivered. Please resend your 450-4.2.1 message at a later time. If the user is able to receive mail at that 450-4.2.1 time, your message will be delivered. For more information, please 450-4.2.1 visit 450 4.2.1  https://support.google.com/mail/?p=ReceivingRate j125si2027576wmj.50 - gsmtp (in reply to RCPT TO command)
Apr 15 10:59:33 server postfix/smtp[14846]: 841DDC0A50: to=<ME@MYDOMAIN.COM>, relay=ALT2.ASPMX.L.GOOGLE.COM[64.233.188.26]:25, delay=1.7, delays=0.05/0/1.3/0.39, dsn=4.2.1, status=deferred (host ALT2.ASPMX.L.GOOGLE.COM[64.233.188.26] said: 450-4.2.1 The user you are trying to contact is receiving mail at a rate that 450-4.2.1 prevents additional messages from being delivered. Please resend your 450-4.2.1 message at a later time. If the user is able to receive mail at that 450-4.2.1 time, your message will be delivered. For more information, please 450-4.2.1 visit 450 4.2.1  https://support.google.com/mail/?p=ReceivingRate u13si4905019pfg.6 - gsmtp (in reply to RCPT TO command))

Changing mydestination to localhost doesn't help.

All other emails are delivered.

Maybe I need some additional settings of relay or transport maps? Because from any other servers messages are delivered to @MYDOMAIN as usual. Thanks.

Have another answer? Share your knowledge.