What the message looks like
Nov 9 08:14:22 mail postfix/smtp[2211]: connect to gmail-smtp-in.l.google.com[142.250.27.26]:25: Connection timed outCommon causes
- The provider blocks outbound port 25 on residential and standard connections to limit spam.
- Cloud providers block 25 by default and only lift it on request.
- The firewall allows 587 and 465 but not 25.
- The destination blocks your IP, for example due to a missing PTR or a blacklist entry.
- A missing IPv6 route makes the attempt hang instead of failing fast.
Check
- Test outbound port 25
nc -vz -w 5 gmail-smtp-in.l.google.com 25 - Inspect the mail queue
mailq | tail -n 20 - Typical errors in the log
- Public IP and PTR
Fix
- Instead of delivering directly to MX hosts on 25, use submission on port 587 with STARTTLS and authentication:
relayhost = [smtp.provider.tld]:587. - On clouds, request that port 25 be unblocked if direct delivery is really required.
- Set PTR, SPF and DKIM correctly, otherwise even allowed delivery is rejected.
- Allow 587 and 465 outbound in the firewall and block 25 deliberately if you do not need it.
- Watch the queue and flush it with
postqueue -fafter switching to the relay.
Typical scenario
A self-run Postfix on a home server no longer delivers anything. mailq shows a growing queue, and the log says connect to gmail-smtp-in.l.google.com[...]:25: Connection timed out. The mail server is fine, but the internet provider filters outbound traffic on port 25, as many consumer connections do. Check with nc -vz -w 5 gmail-smtp-in.l.google.com 25 whether the connection is made at all.
FAQ
Can I work around port 25?
Yes, through the provider's submission port with authentication or through a relay. Direct MX delivery needs 25.
Why do some messages still arrive?
Because they go through a relay or another port. Only direct delivery to MX hosts on port 25 fails.
How do I tell a block from greylisting?
With greylisting your server connects, and the recipient answers with a temporary error such as 450 or 451, which you see in the log. With a block on port 25 there is no answer at all, and the connection runs into a timeout. The log then shows only connection errors, no SMTP reply.
How long does the mail stay in the queue?
Postfix keeps retrying at growing intervals and by default gives up after maximal_queue_lifetime of five days. After that an error message goes to the sender. So you have time to fix the cause, and the mails go out on the next attempt.
Does the block also affect receiving?
Not automatically. The block usually applies only to outbound connections on port 25. Incoming mail needs your port 25 reachable from outside, which many home connections lack anyway, for example because of CGNAT or a missing port forward.