Use port 993 for IMAP, 995 for POP3, and 587 or 465 for sending mail (SMTP). All four are encrypted: 993, 995 and 465 use TLS from the moment you connect, and 587 switches to TLS with a command called STARTTLS. Port 25 is for mail servers passing messages to each other, and ports 143 and 110 are the unencrypted versions of IMAP and POP.
For definitions of IMAP, POP, SMTP and the rest, see our email glossary.
Email port numbers at a glance
| Port | Protocol | Used for | Encryption | Use it in a mail app? |
|---|---|---|---|---|
| 587 | SMTP (submission) | Sending mail from your app | STARTTLS | Yes, the most widely listed |
| 465 | SMTP (submissions) | Sending mail from your app | TLS from the start (implicit TLS) | Yes, if your provider lists it |
| 25 | SMTP (relay) | Server-to-server delivery | Plain, can upgrade with STARTTLS | No; often blocked |
| 2525 | SMTP | Fallback some sending services offer | Plain or STARTTLS | Only if your service lists it |
| 993 | IMAP | Reading and syncing mail | Implicit TLS | Yes |
| 143 | IMAP | Reading and syncing mail | None (cleartext port) | No, use 993 |
| 995 | POP3 | Downloading mail | Implicit TLS | Yes |
| 110 | POP3 | Downloading mail | None (cleartext port) | No, use 995 |
Ports for sending mail (SMTP): 587, 465, 25 and 2525
Port 587
Port 587 is the message submission port. RFC 6409 reserves it for mail apps handing new messages to their provider, and a server on 587 normally won't accept mail until you sign in. The connection starts in plain text and the app sends STARTTLS to switch to encryption before signing in. Gmail, Outlook.com, iCloud and Yahoo all list 587.
Port 465
Port 465 does the same job with implicit TLS: the encrypted connection is set up first, before any SMTP is exchanged. RFC 8314 (2018) registered 465 for this "submissions" service and says mail should connect over implicit TLS rather than a cleartext port where it can. Gmail and Yahoo list 465; Outlook.com and iCloud list only 587.
Port 25
Port 25 is the original SMTP port, which mail servers use to deliver to each other. Your provider's server uses it to reach the recipient's server, but your app shouldn't. RFC 6409 notes that many sites block outbound traffic to port 25, and cloud hosts are among them. Google Cloud, for example, blocks outbound connections to port 25 "due to the risk of abuse" while leaving 587 and 465 open.
Port 2525
Port 2525 isn't one of the standard ports. Some sending services offer it as a fallback for networks that block the others: SendGrid, for example, lists 25, 2525 and 587 for unencrypted or TLS connections and 465 for SSL. Mail providers like Gmail don't list it, so only use 2525 if your service's setup page does.
Ports for receiving mail: 993, 143, 995 and 110
IMAP listens on port 143 (cleartext) or 993 (implicit TLS), as set out in RFC 9051. POP3 uses port 110, from RFC 1939, and 995 for POP3 over TLS. RFC 8314 updated the registrations for 993 and 995 so TLS starts as soon as the connection opens, and requires apps to check the server's certificate.
In practice, use 993 or 995. The big providers' setup pages only list the encrypted ports, and the cleartext ones aren't encrypted when the connection opens.
TLS vs STARTTLS: what the encryption settings mean
Mail apps usually offer two choices, labelled something like "SSL/TLS" and "STARTTLS":
- SSL/TLS (implicit TLS) encrypts from the first byte. It goes with ports 465, 993 and 995.
- STARTTLS connects in plain text, then upgrades to TLS before you sign in. It goes with port 587, and servers also use it on port 25.
Both end up encrypted, but the setting has to match the port. Pick SSL/TLS on 587, or STARTTLS on 465, and the connection usually fails or times out. If a server wants encryption and your app doesn't start it, Gmail answers with error 530 "Must issue a STARTTLS command first".
TLS protects mail between your app and the server. It doesn't encrypt the message itself on the servers; that takes end-to-end encryption, covered in our guide to encrypted email vs private email. Our email security guide covers the rest of the basics.
Port 587 vs 465: which should you use?
Either is fine if your provider lists it. 587 is the safer default because all four big providers support it. 465 has the edge in principle, since the connection is never unencrypted, and RFC 8314 prefers implicit TLS. During the transition, though, it says servers and apps should support both STARTTLS on 587 and implicit TLS on 465.
In practice, use what your provider's setup page shows. If one port times out on a particular network, try the other before changing anything else.
Port settings for Gmail, Outlook.com, iCloud and Yahoo
Checked on each provider's help page on 16 November 2026.
| Provider | IMAP | POP | SMTP |
|---|---|---|---|
| Gmail | imap.gmail.com, 993 | pop.gmail.com, 995 | smtp.gmail.com, 587 (STARTTLS) or 465 (SSL/TLS) |
| Outlook.com, Hotmail, Live | outlook.office365.com, 993 | outlook.office365.com, 995 | smtp-mail.outlook.com, 587 (STARTTLS) |
| iCloud Mail | imap.mail.me.com, 993 | Not supported | smtp.mail.me.com, 587 |
| Yahoo Mail | imap.mail.yahoo.com, 993 | pop.mail.yahoo.com, 995 | smtp.mail.yahoo.com, 465 or 587 |
All of them need SSL/TLS on the incoming ports and authentication on the outgoing server. Gmail and Outlook.com prefer their own sign-in (OAuth); iCloud needs an app-specific password, and Yahoo points you to an app password.
How to check if a port is open
If your app can't connect, test whether the port is reachable from your network:
- Windows (PowerShell): run Test-NetConnection -ComputerName smtp.gmail.com -Port 587. "TcpTestSucceeded : True" means the port is open.
- Mac or Linux (Terminal): run nc -vz smtp.gmail.com 587. A line ending "succeeded!" means it's open; a timeout means something is blocking it.
- Check the encryption too: openssl s_client -connect imap.gmail.com:993 tests an implicit TLS port, and openssl s_client -connect smtp.gmail.com:587 -starttls smtp tests STARTTLS. Both should print the TLS version and certificate.
Swap in your own server name and port. If the test fails on your home or office network but works on your phone's hotspot, that network is blocking the port. Use the other sending port (587 or 465), or ask whoever runs the network.
Common port problems
- Can receive but can't send: the incoming ports work, so look at the SMTP port. Port 25 is the usual culprit; change it to 587 with STARTTLS or 465 with SSL/TLS. On a Mac, see Apple Mail not sending emails.
- Connection times out: the port is blocked, or the encryption setting doesn't match the port.
- Certificate warning: often the server name you typed doesn't match the server's certificate. Use the exact host name from your provider's setup page.
- IMAP stopped working: check the server name, port 993 and SSL/TLS, then the password or sign-in. For Mac Mail, see Mac Mail not connecting to the server.
FAQ
Is IMAP port 143 or 993?
Both are IMAP ports. 993 is IMAP over TLS and is the one to use. 143 is the cleartext port. Gmail, Outlook.com, iCloud and Yahoo all list 993.
Which port should I use for SMTP, 587 or 465?
Either, as long as your provider lists it. Port 587 uses STARTTLS and is supported by Gmail, Outlook.com, iCloud and Yahoo. Port 465 uses TLS from the start and is supported by Gmail and Yahoo. Match the encryption setting to the port.
What port does POP3 use?
Port 995 for POP3 over TLS, which is what Gmail, Outlook.com and Yahoo list. Port 110 is the original unencrypted POP3 port. iCloud Mail doesn't support POP.
Why is port 25 blocked?
Port 25 is for servers relaying mail to each other, so mail apps don't need it. Many networks and cloud hosts block outgoing connections to it to stop abuse; Google Cloud blocks it for that reason. Send on 587 or 465 instead.
What is port 2525 used for?
It's a non-standard SMTP port that some sending services, such as SendGrid, offer as a fallback when 25 and 587 are blocked. Regular mail providers don't list it, so use it only if your service's setup page does.
Sources
- IETF: RFC 8314: Use of TLS for Email Submission and Access
- IETF: RFC 6409: Message Submission for Mail
- IETF: RFC 9051: Internet Message Access Protocol (IMAP) Version 4rev2
- IETF: RFC 1939: Post Office Protocol Version 3
- IETF: RFC 5321: Simple Mail Transfer Protocol
- Google: IMAP, POP and SMTP for Gmail (developers)
- Google: Read Gmail messages on other email clients using POP
- Google: Gmail SMTP errors and codes
- Google Cloud: Sending email from an instance
- Microsoft: POP, IMAP, and SMTP settings for Outlook.com
- Microsoft: Test-NetConnection
- Apple: iCloud Mail server settings for other email client apps
- Yahoo: IMAP server settings for Yahoo Mail
- Yahoo: POP access settings and instructions for Yahoo Mail
- Twilio SendGrid: Integrating with the SMTP API