postfix error: Connection timed out & No route to host

postfix isn’t sending mail and I am not sure what is wrong:

Nov 14 22:12:05 new.halearn2app.com postfix/smtp[973830]: connect to gmail-smtp-in.l.google.com[74.125.192.27]:25: Connection timed out
Nov 14 22:12:08 new.halearn2app.com postfix/smtp[973830]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400d:c00::1b]:25: No route to host
Nov 14 22:12:38 new.halearn2app.com postfix/smtp[973830]: connect to alt1.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
Nov 14 22:12:40 new.halearn2app.com postfix/smtp[973830]: connect to alt1.gmail-smtp-in.l.google.com[2800:3f0:4003:c00::1b]:25: No route to host
Nov 14 22:13:10 new.halearn2app.com postfix/smtp[973830]: connect to alt2.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out
Nov 14 22:13:10 new.halearn2app.com postfix/smtp[973830]: 2F6731A08C4C: to=[email protected], relay=none, delay=95, delays=0.09/0.02/95/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out)

I have an external smtp service set under Manage Services → Manage Postfix

And the mail is showing in the mail que:

deferred 576 [email protected] [{“address":"[email protected]”,“delay_reason”:“connect to alt2.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out”}]

1 Like

● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-11-14 22:41:10 UTC; 1min 6s ago
Process: 64990 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
Process: 65003 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
Process: 65001 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 64999 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
Main PID: 65069 (master)
CGroup: /system.slice/postfix.service
├─65069 /usr/libexec/postfix/master -w
├─65070 pickup -l -t unix -u
├─65071 qmgr -l -t unix -u
├─67856 cleanup -z -t unix -u
├─67858 proxymap -t unix -u
├─67859 trivial-rewrite -n rewrite -t unix -u
├─67861 smtp -t unix -u
├─67862 tlsmgr -l -t unix -u
└─67863 bounce -z -t unix -u

Nov 14 22:42:04 new.halearn2app.com postfix/pickup[65070]: 3238C1A08C4D: uid=0 from=
Nov 14 22:42:04 new.halearn2app.com postfix/cleanup[67856]: 3238C1A08C4D: message-id=[email protected]
Nov 14 22:42:04 new.halearn2app.com postfix/qmgr[65071]: 3238C1A08C4D: from=[email protected], size=955, nrcpt=1 (queue active)
Nov 14 22:42:04 new.halearn2app.com postfix/smtp[67861]: 3238C1A08C4D: to=[email protected], orig_to=, relay=none, delay=3.2, delays=3.1/0.0…t found)
Nov 14 22:42:04 new.halearn2app.com postfix/cleanup[67856]: 4C3191A08C4E: message-id=[email protected]
Nov 14 22:42:04 new.halearn2app.com postfix/qmgr[65071]: 4C3191A08C4E: from=<>, size=3057, nrcpt=1 (queue active)
Nov 14 22:42:04 new.halearn2app.com postfix/bounce[67863]: 3238C1A08C4D: sender non-delivery notification: 4C3191A08C4E
Nov 14 22:42:04 new.halearn2app.com postfix/qmgr[65071]: 3238C1A08C4D: removed
Nov 14 22:42:04 new.halearn2app.com postfix/smtp[67861]: 4C3191A08C4E: to=[email protected], relay=none, delay=0.01, delays=0/0/0.01/0, dsn=5.4.4,…t found)
Nov 14 22:42:04 new.halearn2app.com postfix/qmgr[65071]: 4C3191A08C4E: removed

I have this same problem, just as you described. Mine says:
Dec 27 20:23:41 mail dovecot: imap([email protected])<21206><Okz3N9nwyOl/AAAB>: Logged out in=89 out=1006 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Dec 27 20:23:44 mail postfix/smtp[21165]: connect to smtp.secureserver.net[68.178.213.37]:25: Connection timed out

I am thinking it’s a Godaddy issue, as they do all sorts of things on the backend to prevent sending. They offer a relay-hosting method but give little support when you are using a system like cyberpanel. I successfully receive emails, but the outgoing is unsuccessful.

Here’s what needs to be done to get mail sending, in SSH:
(this is on typical godaddy VPS, yours may differ)

nano /etc/postfix/main.cf

Add these lines:

relayhost = [dedrelay.secureserver.net]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Create password file:
nano /etc/postfix/sasl_passwd

Insert this, 1 line:

[dedrelay.secureserver.net]:587 [username]:[password]

Save, then

postmap /etc/postfix/sasl_passwd
chown root:postfix /etc/postfix/sasl_passwd*
chmod 640 /etc/postfix/sasl_passwd*

systemctl restart postfix && systemctl enable postfix