SMTP Ports Explained: 587 vs 465 vs 25
Which email port to use: 587 with STARTTLS or 465 with SSL/TLS for sending, 25 only for server relay, and 993 or 995 for incoming mail. How to match encryption, test a port and fix errors.
Email uses a small set of port numbers, and mail apps ask for them every time you add an account. The ones that matter for sending are 587, 465 and 25; for receiving, 993 (IMAP) and 995 (POP3). Each port expects a particular kind of encryption, and choosing a port without its matching setting is the most common reason an account receives mail but can't send it.
Short answer: in a mail app, use 587 with STARTTLS or 465 with SSL/TLS, whichever your provider lists first. Port 25 is for servers relaying mail to each other, not for your app. For incoming mail, use 993 for IMAP or 995 for POP3, both with SSL/TLS.
Looking for a specific provider's server names? See the SMTP server settings for every provider, or enter any address in the Email Settings Finder.
Email ports at a glance
| Port | Protocol | Encryption to choose | Use it for |
|---|---|---|---|
| 587 | SMTP submission | STARTTLS | Sending from a mail app, phone, printer or website |
| 465 | SMTP submission | SSL/TLS (implicit TLS) | Sending from a mail app, phone, printer or website |
| 25 | SMTP relay | Set by the server | Mail servers passing mail to each other; documented relay services |
| 993 | IMAP | SSL/TLS | Reading mail that stays synced on the server |
| 995 | POP3 | SSL/TLS | Downloading mail to one device |
| 143 | IMAP | None, or STARTTLS | Older setups; avoid where 993 is offered |
| 110 | POP3 | None, or STARTTLS | Older setups; avoid where 995 is offered |
The standard for email encryption asks providers to phase out unencrypted access "as soon as practicable" (RFC 8314), so 143 and 110 without encryption are on their way out. Use 993 and 995 whenever the provider lists them.
Port 587: submission with STARTTLS
Port 587 is reserved for message submission: the step where your mail app hands a new message to your provider (RFC 6409). The connection opens unencrypted and the app then issues a STARTTLS command, which upgrades it to an encrypted TLS session before your username and password are sent.
The submission standard also requires the server to refuse to send mail for a session that hasn't signed in (RFC 6409, section 4.3). That's why "outgoing server requires authentication" has to be switched on in your app. Without it, the server answers with an "authentication required" error and nothing leaves the outbox.
Some apps label this setting "TLS" rather than "STARTTLS". On port 587 they mean the same thing.
Port 465: submission over implicit TLS
Port 465 does the same job as 587, but the connection is encrypted from the first byte. There is no unencrypted greeting and no upgrade step; the TLS handshake starts the moment the app connects. The standard calls this implicit TLS, and mail apps usually label it "SSL/TLS" or just "SSL".
Is port 465 deprecated?
No, though it once looked that way, and older articles still say so. Port 465 was briefly registered for SMTP over SSL ("smtps"). That registration was revoked and the port was reassigned to a different service. Widely used mail software kept using 465 for encrypted submission anyway (RFC 8314, section 7.3).
In 2018, RFC 8314 made that practice official. It registered port 465 as "submissions" (message submission over TLS) and recommended that providers advertise implicit TLS in preference to STARTTLS. Port 465 is a current, standard submission port.
Port 25: server-to-server relay
Port 25 is the original SMTP port. Today it carries mail between servers: when your provider delivers a message to the recipient's provider, that hop uses port 25. The submission standard keeps relay on port 25 and moves mail apps to 587 (RFC 6409).
Don't use port 25 in a normal mail app. It only belongs in your settings where a provider documents it for a specific purpose, for example:
- Microsoft 365 direct send and SMTP relay for printers and line-of-business apps use port 25. Signed-in sending from an app or device (SMTP AUTH) uses
smtp.office365.comon 587. See Microsoft 365 SMTP settings. - Google Workspace SMTP relay (
smtp-relay.gmail.com) accepts ports 25, 465 and 587, and is set up by the Workspace administrator.
587 vs 465: which is better?
For security, neither. RFC 8314 says there is "no significant difference" between STARTTLS on 587 and implicit TLS on 465, as long as both are implemented correctly and encryption is required. The same document asks clients and servers to support both during a transition period of several years, while advertising implicit TLS (465) first.
In practice, use the port your provider lists first, and only switch if it won't connect on your network. When you switch, change the encryption setting with it. Providers differ:
| Provider | SMTP server | First choice | Alternative |
|---|---|---|---|
| Gmail | smtp.gmail.com | 587, STARTTLS | 465, SSL/TLS |
| Outlook.com, Hotmail, Live | smtp-mail.outlook.com | 587, STARTTLS | None documented |
| Microsoft 365 | smtp.office365.com | 587, STARTTLS | 465 is not supported |
| Yahoo Mail | smtp.mail.yahoo.com | 465, SSL/TLS | 587, STARTTLS |
| iCloud Mail | smtp.mail.me.com | 587, STARTTLS | None documented |
| AOL Mail | smtp.aol.com | 465, SSL/TLS | None documented |
| Zoho Mail | smtp.zoho.com | 465, SSL/TLS | 587, STARTTLS |
| GMX | mail.gmx.com | 587, STARTTLS | 465, SSL/TLS |
| Fastmail | smtp.fastmail.com | 465, SSL/TLS | 587, STARTTLS |
The full list, with usernames and password requirements for 15 providers, is in the SMTP server settings guide.
Match the port to the encryption
A port and its encryption setting are a pair. Mail apps name the settings differently, but there are only two combinations that work for sending:
| If the port is | Choose | Also called |
|---|---|---|
| 587 | STARTTLS | "TLS", "TLS if available" (pick a setting that requires it where offered) |
| 465 | SSL/TLS | "SSL", "implicit TLS" |
If they're mismatched, the connection fails even though the server name is correct:
- 465 with STARTTLS: the server waits for a TLS handshake while the app waits for a plain-text greeting. Usually the result is a timeout.
- 587 with SSL/TLS: the app starts a TLS handshake that the server isn't expecting yet. Usually the result is an immediate SSL or handshake error. OpenSSL-based apps often report it as "wrong version number".
TLS versions
Encryption on any of these ports must use a modern version of TLS. The email standard now sets TLS 1.2 as the minimum for submission and mail access (RFC 8314, updated by RFC 8997, which deprecated TLS 1.1). Microsoft 365 requires TLS 1.2 or 1.3, and GMX accepts only TLS 1.2 and 1.3. An old printer, scanner or app that can't negotiate TLS 1.2 won't connect on any port. Check for a firmware or app update, or use a relay service documented for older devices.
How to test an SMTP port
If settings look right but nothing connects, check whether your network can reach the port at all.
Windows (PowerShell):
Test-NetConnection -ComputerName smtp.gmail.com -Port 587
TcpTestSucceeded : True means the port is reachable from your network. This only tests the connection, not the encryption or your password.
macOS or Linux (Terminal), port 465:
openssl s_client -connect smtp.gmail.com:465 -crlf
Port 587 with STARTTLS:
openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf
A working connection prints the server's certificate and then a line beginning with 220 or 250. Type QUIT and press Enter to close it. Replace smtp.gmail.com with your provider's server.
If the test fails on one port, try the provider's other documented port. If both fail on one network but work on another (mobile data, for example), the network is filtering outgoing mail connections. Ask that network's administrator, or use the other network.
Fixing common port errors
- Connection times out: check the port and encryption pair first. Then test the port as shown above. Many networks restrict outgoing mail traffic, especially on port 25.
- SSL, TLS or handshake error: the encryption setting doesn't match the port, or the device can't do TLS 1.2. Re-pair them as in the table above.
- "Must issue a STARTTLS command first": you're on 587 with encryption off. Set it to STARTTLS.
- "Authentication required" or "530": turn on authentication for the outgoing server and enter the full email address as the username.
- Password rejected on the right port: the port is fine. Most providers now need an app password or the app's built-in Google or Microsoft sign-in. See why the SMTP password is refused.
How this guide was checked · October 2026
Verified against 14 official sources
Every step, setting and limit in this guide was checked against the provider’s own documentation on datatracker.ietf.org, support.google.com, knowledge.workspace.google.com and 8 more. Anything we couldn’t confirm was left out.
- 01 IETF RFC 6409: Message Submission for Mail datatracker.ietf.org
- 02 IETF RFC 8314: Use of TLS for Email Submission and Access datatracker.ietf.org
- 03 IETF RFC 8997: Deprecation of TLS 1.1 for Email Submission and Access datatracker.ietf.org
- 04 Google: Read Gmail with POP (SMTP settings) support.google.com
- 05 Google Workspace: Send email from a printer, scanner or app knowledge.workspace.google.com
- 06 Microsoft: POP, IMAP and SMTP settings for Outlook.com support.microsoft.com
- 07 Microsoft Learn: Send email from a device or application using Microsoft 365 learn.microsoft.com
- 08 Yahoo: IMAP server settings for Yahoo Mail help.yahoo.com
- 09 Apple: iCloud Mail server settings for other email client apps support.apple.com
- 10 Zoho: IMAP and SMTP configuration zoho.com
- 11 GMX: Problems setting up GMX in an email program support.gmx.com
- 12 Fastmail: Server names and ports fastmail.help
- 13 Microsoft Learn: Test-NetConnection learn.microsoft.com
- 14 OpenSSL: s_client manual manpages.debian.org
Questions
Frequently asked questions
What is port 587 used for?
Sending email from a mail app, phone or device to your provider (message submission). It starts unencrypted and upgrades with STARTTLS before you sign in, and the server requires you to sign in before it will send.
What is port 465?
The other port for sending email from an app. It's encrypted from the first byte (implicit TLS, labelled SSL/TLS in most apps). Since RFC 8314 in 2018 it has been officially registered for message submission over TLS.
Is port 465 deprecated?
No. It was briefly registered for SMTP over SSL, revoked, and later made official again as the "submissions" port by RFC 8314, which recommends implicit TLS over STARTTLS.
Which is more secure, 587 or 465?
Neither, when both are set up properly and encryption is required: RFC 8314 finds no significant security difference. Use the port your provider lists first, with its matching encryption.
Can I use port 25 to send email from my mail app?
Not normally. Port 25 is for mail servers relaying to each other. Use it only where a provider documents it, such as Microsoft 365 direct send or Google Workspace SMTP relay.
What ports do IMAP and POP3 use?
IMAP uses 993 and POP3 uses 995, both with SSL/TLS. The older ports 143 and 110 start unencrypted and are being phased out.
Why does my SMTP connection time out?
Usually the port and encryption don't match (465 needs SSL/TLS, 587 needs STARTTLS), or the network blocks that port. Fix the pair first, then test the port or try the provider's other documented port.
Related guides
Keep reading
Server Settings SMTP
SMTP Server Settings for Every Email Provider
Outgoing SMTP server, port and encryption for Gmail, Outlook, Microsoft 365, Yahoo, iCloud and more — plus how to pick 587 or 465 and why your password is refused.
7 min read
Microsoft 365 SMTP
Microsoft 365 SMTP Settings
The SMTP server, port and encryption for Microsoft 365 work mailboxes, how to turn on SMTP AUTH, and what to do when a printer or app still won't send.
5 min read
Gmail SMTP
Gmail SMTP Settings
The current Gmail SMTP server, port, encryption and authentication requirements, plus focused fixes for failed authenticated outgoing mail submission.
4 min read
Outlook.com SMTP
Outlook.com SMTP Settings
The current Outlook.com SMTP server, port, encryption and authentication requirements, plus focused fixes for failed authenticated outgoing mail submission.
4 min read
Yahoo Mail SMTP
Yahoo Mail SMTP Settings
The current Yahoo Mail SMTP server, port, encryption and authentication requirements, plus focused fixes for failed authenticated outgoing mail submission.
4 min read
Optimum Email Settings
Optimum Email Settings: IMAP, POP & SMTP (Suddenlink Too)
Optimum’s IMAP, POP and SMTP settings for Outlook, iPhone, Gmail and other apps — with the separate Suddenlink servers.
2 min read