SMTP Ports Explained: 25, 465, 587 and 2525 (and Which One to Use)
Use port 587 with STARTTLS or port 465 with implicit TLS to send email from an app or email client. Port 25 is for server-to-server delivery. Pick your provider below to see the exact ports it supports.
Results
- Based on RFC 8314 and RFC 6409
- Ports for nearly 100 providers
- Free, no signup
SMTP ports at a glance
There are four SMTP ports you will meet in practice. Two are made for sending from an app or email client (587 and 465), one is for mail servers talking to each other (25), and one is an unofficial fallback offered by sending services (2525).
| Port | Encryption | What it is for | Use it to send from an app? |
|---|---|---|---|
| 587 | STARTTLS (upgrades to TLS after connecting) | Message submission from apps and email clients (RFC 6409) | Yes, the default choice |
| 465 | Implicit TLS (encrypted from the first byte) | Message submission over TLS (RFC 8314) | Yes, as secure as 587 |
| 25 | Optional STARTTLS | Relay between mail servers (RFC 5321) | No, usually blocked by ISPs and cloud hosts |
| 2525 | STARTTLS | Unofficial alternative to 587 offered by sending services | Only if 587 and 465 are blocked |
Short answer: use 587 with STARTTLS. If your app only offers SSL/TLS from the start of the connection, use 465. Never configure port 25 in an app, and keep 2525 for networks that block the standard ports.
Which SMTP port should you use?
Port 587: the default for sending
Port 587 is the official message submission port. The connection starts in plain text, then the client sends the STARTTLS command and the session switches to TLS before you log in. Almost every email provider and sending service supports it, and it is the port to try first.
Port 465: implicit TLS, fully standard again
Port 465 opens an encrypted connection immediately, with no plain-text step. It was deprecated for years, which is why some old guides still say to avoid it, but RFC 8314 (2018) registered it again as the "submissions" port. The RFC asks clients and servers to support both 587 and 465 and states there is no significant security difference between them when they are implemented correctly.
Port 25: server-to-server relay
Port 25 is how mail servers deliver messages to each other. It is not meant for apps that log in to send. Most residential ISPs and cloud providers block or restrict outbound port 25 to fight spam, so an app configured on 25 usually times out.
Port 2525: the unofficial fallback
Port 2525 is not registered for SMTP, but sending services such as SendGrid, Mailgun, Brevo, Postmark and Mailjet accept it as a copy of port 587. It helps when a hosting provider blocks the standard ports.
Exceptions to know
Microsoft 365 does not support port 465 for authenticated sending: use 587, or 25 for SMTP relay through a connector. AOL documents 465 only, iCloud documents 587 only. When in doubt, check your provider in the finder above.
SMTP ports by provider
These are the outgoing servers and ports returned by the mailX SMTP Finder for the most used mailbox providers and sending services. The first port listed is the one to try first.
| Provider | SMTP server | Ports |
|---|---|---|
| Gmail and Google Workspace | smtp.gmail.com | 587 STARTTLS, 465 SSL |
| Microsoft 365 | smtp.office365.com | 587 STARTTLS, 25 (465 not supported) |
| Outlook.com, Hotmail | smtp-mail.outlook.com | 587 STARTTLS |
| Yahoo Mail | smtp.mail.yahoo.com | 465 SSL, 587 STARTTLS |
| iCloud Mail | smtp.mail.me.com | 587 STARTTLS |
| AOL Mail | smtp.aol.com | 465 SSL |
| Zoho Mail (US) | smtp.zoho.com | 465 SSL, 587 STARTTLS |
| GoDaddy Professional Email | smtpout.secureserver.net | 465 SSL, 587 STARTTLS |
| SendGrid | smtp.sendgrid.net | 587, 2525, 25 STARTTLS, 465 SSL |
| Mailgun (US) | smtp.mailgun.org | 587, 2525, 25 STARTTLS, 465 SSL |
| Amazon SES (us-east-1) | email-smtp.us-east-1.amazonaws.com | 587, 2587, 25 STARTTLS, 465, 2465 SSL |
| Brevo | smtp-relay.brevo.com | 587, 2525 STARTTLS, 465 SSL |
| Postmark | smtp.postmarkapp.com | 587, 2525, 25 STARTTLS (465 not supported) |
Related mailX tools
Find the server, test the port, then check your domain.
How to test an SMTP port
Four checks to find out whether a port works from where you send.
Find your provider's ports
Pick your provider in the finder above. It lists the server and every port with its encryption.
Start with 587 and STARTTLS
Set the server, port 587, STARTTLS (sometimes called TLS) and authentication on. If the app only offers SSL/TLS, use 465.
Run the mailX SMTP Test
Enter the same host, port, encryption and login. The test tells you whether the server answers, whether TLS works and whether your login is accepted.
Test from the sending machine
A port can be open from your laptop and blocked from your server. Run the command line checks below on the machine that will send.
Check an SMTP port from the command line
These commands open a connection to the server. A greeting that starts with 220 means the port is reachable. Replace smtp.gmail.com with your provider's server.
Port 587 with STARTTLS (macOS, Linux, WSL):
Port 465 with implicit TLS:
Is the port open at all? (Windows PowerShell):
Why your SMTP port does not work
The usual errors and what they mean.
Connection timed out
The port is blocked on your network, by your host or by a firewall. Try 587 or 465, or 2525 with a sending service.
Port 25 blocked by your ISP or cloud
Residential ISPs and most cloud providers block or restrict outbound port 25. Use 587 or 465 to send through your provider.
TLS or SSL handshake error
The port and encryption do not match: 587 goes with STARTTLS, 465 with SSL/TLS. Swap them and try again.
530 Must issue a STARTTLS command first
The server refuses to log you in over plain text. Turn on STARTTLS for port 587.
535 Authentication failed
The port works but the login does not. Gmail, Yahoo, AOL and iCloud need an app password or OAuth in third-party apps.
Port 465 refused by Microsoft 365
Microsoft 365 only accepts authenticated sending on 587 (or 25 through a connector). Switch to 587.
SMTP guides
Go further with SMTP setup and errors.
What Is SMTP and How It Works
How email sending works between your app, your provider and the recipient's server.
Fix an SMTP Connection Timeout
Why the connection hangs and how to find the blocked port.
How to Fix SMTP Errors
What the most common SMTP error codes mean and how to solve them.
Port open, login accepted? Check what happens next.
Your emails reach the inbox when SPF, DKIM and DMARC are set up for your domain. Check all three in one free test.