OquMail
Loading account…
Deliverability3 min readUpdated

Connection Timed Out on Port 25: Why It Happens and the Fix

Port 25 is blocked on most home connections and cloud servers. What the timeout means in Outlook, PHPMailer and scripts, and how to switch to port 587.

"Connection timed out" on port 25 almost never means the mail server is down. It means something between you and the server dropped the packets, and on port 25 that something is nearly always a deliberate block: home internet providers block it, and so do most cloud hosts for new accounts. Port 25 is the port servers use to talk to each other. Mail apps and scripts are supposed to use port 587, which nobody blocks. The fix is usually a one-line change.

Quick answer

Change the outgoing port from 25 to 587, set encryption to STARTTLS, and turn on authentication with your full address and password. That is the submission port, it is open everywhere, and it is what OquMail's server expects from mail apps and scripts. Only a server receiving mail from the internet needs port 25, and if you use a hosted mailbox that is not you.

Who blocks port 25

  • Home and mobile internet providers, almost all of them, to stop infected PCs sending spam.
  • Cloud hosts for new accounts: Google Cloud blocks outbound 25 entirely, Azure for pay-as-you-go subscriptions, and AWS, DigitalOcean, Hetzner, Vultr and Linode restrict it until you ask.
  • Office networks with a firewall that allows only the company mail server to use 25.
  • Hotel and public Wi-Fi.

Where the error shows up

  • Outlook or Thunderbird: "Sending reported error: the connection to the server timed out" after you set the outgoing port to 25 by hand.
  • PHPMailer: "SMTP connect() failed" with "Connection timed out (110)" in the debug output.
  • Python: "TimeoutError: [Errno 110] Connection timed out" from smtplib.SMTP(host, 25).
  • Shell: "telnet mail.oqumail.com 25" hangs and then reports a timeout.
  • Docker or a VPS: a container that worked on a laptop cannot send once deployed. The host blocks 25; see sending from a container or VPS.

Test which port is open

Run these from the machine that has the problem. The first should hang if 25 is blocked; the second should answer within a second with a 220 greeting and then a 250 response listing STARTTLS:

nc -vz -w 5 mail.oqumail.com 25
nc -vz -w 5 mail.oqumail.com 587
openssl s_client -starttls smtp -connect mail.oqumail.com:587 -crlf

Free business email on your own domain

OquMail gives you up to 15 mailboxes on your domain — free — with guided SPF/DKIM/DMARC, webmail, IMAP/SMTP for any mail app, and a send API. Setup is a few DNS records; changes usually take effect within minutes, occasionally up to 48 hours. Start at oqumail.com.

Get started free

Fix it in a mail app

  1. Open the account settings and find the outgoing (SMTP) server. Set the server to mail.oqumail.com, the port to 587, and encryption to STARTTLS (some apps call it TLS; on iPhone it is "Use SSL" on with port 587).
  2. Turn authentication on and enter your full email address as the username and your webmail password.
  3. Save and send a test message to another address you own.

Fix it in code

Every library has the same three settings: host, port 587 and STARTTLS. In PHPMailer that is Host, Port = 587 and SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS with SMTPAuth = true. In Python, smtplib.SMTP(host, 587) followed by starttls() and login(). In Nodemailer, port: 587 with secure: false. If the host itself blocks every outbound SMTP port, which some corporate networks do, send through the HTTP API instead; it needs only port 443.

Common questions

Should I ask my host to unblock port 25?

Only if you run your own mail server that must deliver directly to other servers. For sending through a mailbox, port 587 is the correct port and works without any request.

Port 465 timed out too. Is that the same block?

Usually not. Port 465 is open on most networks but needs implicit SSL rather than STARTTLS. OquMail uses 587 with STARTTLS; set that pair and the timeout goes away.

Why did it work at home and fail at the office?

The office firewall allows 25 only from the company mail server, or blocks all outbound SMTP. Port 587 with authentication is normally allowed; if not, the API over HTTPS always is.