What the message looks like
postfix/smtp[2314]: 4F1A2B3C4D: to=<kunde@example.net>, relay=mail.example.net[203.0.113.25]:25, delay=312, delays=0.1/0/312/0, dsn=4.4.1, status=deferred (connect to mail.example.net[203.0.113.25]:25: Connection timed out)Common causes
- The hosting or cloud provider blocks outgoing port 25 by default, which is common on new cloud VMs and home connections.
- A firewall on your server or in front of it drops outgoing SMTP.
- The recipient's server is down or too slow.
- IPv6 is tried first, but your server has no working IPv6 route.
- A wrong or outdated MX record sends you to an address that does not answer.
Check
- What is in the queue and why?
postqueue -p | head -n 20 - Can your server reach the recipient's port 25? (5 seconds)
nc -vz -w 5 mail.example.net 25 - Relay and IP protocol settings
postconf -n | grep -E 'relayhost|inet_protocols' - Recent timeouts in the log
Fix
- If the provider blocks port 25, ask to have it unblocked, or send through a smarthost:
relayhost = [smtp.provider.example]:587with SASL login. - If IPv6 does not work, restrict Postfix:
inet_protocols = ipv4, thenpostfix reload. - Allow outgoing TCP 25 (or 587 for the relay) in your firewall.
- Check the recipient's MX with
dig MX example.net +shortand try the other MX hosts. - After the fix, retry the queue:
postqueue -f.
Typical scenario
You set up a new VM at a cloud provider and installed Postfix. The queue keeps growing: postqueue -p lists dozens of messages to external recipients, all with "Connection timed out", while local delivery works. New cloud accounts often have outgoing port 25 blocked until you request it to be opened. From the server, test with nc -vz gmail-smtp-in.l.google.com 25 whether the connection can be made at all.
FAQ
Will my messages be lost?
No. Deferred means Postfix retries. By default it keeps trying for five days and then sends a bounce to the sender.
How can I check my mail setup in general?
Use the free mail DNS checker for MX, SPF, DKIM, DMARC and PTR.
How long does Postfix keep trying to deliver the message?
By default up to five days (maximal_queue_lifetime = 5d). The pause between attempts grows from about five minutes to roughly 67 minutes (minimal_backoff_time, maximal_backoff_time). After that Postfix sends a bounce to the sender.
Why does it only affect some recipient domains?
Then the cause is more likely on the other side or on the path to it: an MX host of the domain is down, answers too slowly, or only its IPv6 path is broken. Test each domain separately with dig MX and nc to the hosts listed. If all domains behave the same, port 25 is usually blocked.
Can I use port 587 to deliver directly instead?
No. Servers exchange mail with each other on port 25; 587 is the submission port for mail clients and authenticated relays. It only helps if you send through your provider's smarthost and have an account there.