Get your free beta license ↗
Mail · Postfix

Outgoing mail to other servers stays in the queue

Last updated 30 Nov 2026
Summary

Mail to other servers stays in the queue, deferred with Connection timed out or Connection refused on port 25. When your hosting provider blocks outgoing connections on that port, you can restore Postfix delivery by asking the provider to open it or by using a smarthost.

Symptoms

Mail between mail accounts on the server arrives. Mail to other servers stays in the queue.

List the queue to see why each message was deferred.

urbestack-mail-queue-list

The delay_reason for an affected message looks like this.

Output
connect to mx.example.net[198.51.100.7]:25: Connection timed out

You may also see Connection refused in delay_reason.

Cause

Postfix delivers mail to other servers on port 25. Many cloud and VPS providers block outgoing connections to port 25 by default or for new accounts.

Resolution

  1. Test whether your server can reach port 25 on a receiving server.

    timeout 10 bash -c 'cat < /dev/null > /dev/tcp/gmail-smtp-in.l.google.com/25' && echo "port 25 open" || echo "port 25 blocked"
  2. If the command prints port 25 blocked, ask your hosting provider to open outgoing port 25.

  3. You can also send through a smarthost, a relay that accepts your server's mail on port 587. The command defaults to port 587 and requires TLS by default. It reads the relay's password from standard input.

    urbestack-mail-smarthost-set --host smtp.relay.example --user relay-user --password-stdin
  4. Use --name example.com to apply the smarthost to one domain only.

  5. Then retry every queued message at once.

    urbestack-mail-queue-flush
  6. Run urbestack-mail-queue-list again and check that the queue empties.