SMTP Ports: 25, 465, 587 and 2525 Explained
Four ports, four different jobs. Here is exactly which SMTP port to use, what encryption belongs with each, why port 25 is blocked almost everywhere, and what to do when your host blocks them all.
Choosing the wrong SMTP port is the second most common cause of failed email delivery, right behind bad credentials. The symptoms are distinctive: a connection that hangs until it times out usually means a blocked port, while an immediate TLS handshake failure usually means the port and encryption method don't match.
SMTP port comparison
| Port | Encryption | Purpose | Blocked? | Verdict |
|---|---|---|---|---|
| 587 | STARTTLS | Authenticated client submission (RFC 6409) | Rarely | Use this first |
| 465 | Implicit SSL/TLS | Submission over TLS from the first byte (RFC 8314) | Rarely | Excellent alternative |
| 25 | Optional STARTTLS | Server-to-server relay (MTA to MTA) | Almost always | Not for applications |
| 2525 | STARTTLS | Unofficial fallback offered by relays | Sometimes | Last resort |
Port 587 — the modern default
Port 587 is the message submission port defined by RFC 6409. It exists
specifically for authenticated clients handing mail to their own provider, which is exactly
what your application, mail client or CMS is doing. The connection opens unencrypted, the
client issues EHLO, the server advertises STARTTLS, and the session
is upgraded to TLS before any credentials are transmitted.
Because 587 is reserved for authenticated submission rather than anonymous relay, it is not a useful channel for spam — which is why ISPs and cloud providers leave it open.
Use port 587 when: you are sending from an application, website, CMS, mail client or script and you have a username and password. This covers almost every real-world case.
Port 465 — implicit TLS
Port 465 establishes TLS immediately, before any SMTP command is exchanged. There is no plaintext phase at all. It was deprecated for SMTPS in 1998, then formally reinstated by RFC 8314 in 2018 as the recommended port for implicit-TLS submission.
It is the preferred port at Yahoo, AOL, Zoho, GoDaddy, Hostinger and Namecheap, and is fully supported by Gmail. Some older libraries handle implicit TLS more reliably than STARTTLS, so 465 is often the quickest fix for a stubborn handshake failure.
Use port 465 when: your provider recommends it, port 587 is blocked, or your client library struggles with STARTTLS negotiation.
Port 25 — relay only, and usually blocked
Port 25 is the original SMTP port and still carries nearly all server-to-server mail transfer on the internet. When a Gmail server delivers a message to a Microsoft 365 server, it does so over port 25.
It is not meant for client submission. Because it historically accepted unauthenticated connections, compromised machines used it to send spam at scale. The response was universal:
- Residential and mobile ISPs block outbound port 25 almost without exception.
- AWS EC2 throttles it by default and requires a support request plus a verified use case.
- Google Cloud blocks it permanently with no exception process.
- Azure blocks it on most subscription types.
- DigitalOcean, Linode, Vultr and Oracle Cloud block it on new accounts.
If your SMTP test on port 25 times out, the port is almost certainly blocked upstream rather than broken. Switch to 587 or 465 — do not spend time debugging the mail server.
Port 2525 — the unofficial fallback
Port 2525 appears in no RFC and is not registered with IANA for mail submission. It became a convention among transactional relays as an escape hatch for customers on hosting plans that block every standard mail port. SendGrid, Mailgun, Brevo, Postmark, Mailjet and SMTP2GO all listen on it, carrying ordinary STARTTLS-encrypted traffic.
Mailbox providers such as Gmail, Outlook.com and Yahoo do not offer 2525. It is a relay-only option.
Matching the port to the encryption setting
A surprising share of SMTP failures come from pairing the right port with the wrong encryption option. Use this table:
| Port | Correct setting | If you choose wrongly |
|---|---|---|
| 587 | STARTTLS / "TLS" | Choosing SSL causes a handshake timeout — the server expects plaintext first. |
| 465 | SSL/TLS / "Implicit" | Choosing STARTTLS causes an immediate protocol error — the server is already speaking TLS. |
| 25 | None or STARTTLS | Forcing SSL fails — port 25 never uses implicit TLS. |
| 2525 | STARTTLS | Same failure mode as 587. |
Not sure? Leave encryption on Auto in the SMTP test tool and it will select SSL for 465, STARTTLS for 587 and no encryption for 25 automatically.
How to tell whether a port is blocked
Three outcomes, three different diagnoses:
- Connection times out — a firewall is silently dropping packets. The port is blocked by your network, ISP or cloud provider.
- Connection refused — packets reached the host but nothing is listening on that port. The port number or hostname is wrong.
- Connects, then fails on TLS — the port is open and reachable. The problem is the encryption setting or the certificate.
From a terminal you can confirm it directly:
# Check whether the port accepts a connection at all
telnet smtp.example.com 587
# Run the full STARTTLS handshake and inspect the certificate
openssl s_client -starttls smtp -connect smtp.example.com:587
# Test implicit TLS on port 465
openssl s_client -connect smtp.example.com:465
Frequently asked questions
Use port 587 with STARTTLS. It is the IETF standard for authenticated mail submission (RFC 6409), it is supported by effectively every provider, and it is rarely blocked. If 587 is unavailable, use 465 with implicit SSL/TLS. Only fall back to 2525 if both are blocked by your host.
Both deliver authenticated, encrypted mail submission — they differ only in when encryption starts. Port 587 opens in plaintext and upgrades to TLS with the STARTTLS command. Port 465 wraps the connection in TLS from the very first byte (implicit TLS). With modern TLS versions both are equally secure. What matters is matching your client's encryption setting to the port.
Port 25 is the server-to-server relay port and requires no authentication, which made it the primary channel for spam sent from compromised machines. Virtually every residential ISP and cloud provider — AWS, Azure, Google Cloud, DigitalOcean, Oracle Cloud — blocks outbound port 25 by default and rarely unblocks it. Use port 587 or 465 for sending from an application instead.
Port 2525 is not an official SMTP port and is not registered with IANA for mail. It became a de-facto convention among transactional relays — SendGrid, Mailgun, Brevo, SMTP2GO, Postmark and others — as a fallback for customers whose hosting provider blocks 25, 465 and 587. It carries the same STARTTLS-encrypted traffic as port 587.
No. Port 465 was deprecated for SMTPS in 1998, but RFC 8314 (published in 2018) formally reinstated it as the recommended port for implicit-TLS message submission. It is fully supported today and is the preferred port at Yahoo, AOL, Zoho and many hosting providers.
Run a test with the SMTP checker on that port — a timeout means the port is blocked somewhere between you and the server. From a terminal you can also use telnet smtp.example.com 587 or openssl s_client -starttls smtp -connect smtp.example.com:587. A connection refused means nothing is listening; a hang means a firewall is silently dropping packets.
Use a transactional relay that offers alternative ports. SendGrid and Mailgun accept submissions on 2525; SMTP2GO also listens on 8025 and 80. Alternatively, switch to the provider's HTTP API, which travels over port 443 and is never blocked.