Skip to content
DFY Inbox Setup

SMTP and IMAP Ports Explained: 25, 465, 587 and 993

Which port does what: 25, 465 and 587 for sending, 993 and 143 for IMAP, 995 and 110 for POP3, the difference between STARTTLS and SSL, and how to test a blocked port.

Photo of Farhan MujahidBy Farhan MujahidFounder and CEO, DFY Inbox Setup

Updated · 6 min read

Quick answer

If an app asks for an outgoing (SMTP) port, use 587 with STARTTLS, or 465 with SSL/TLS if your provider lists it. For incoming mail, use IMAP on 993. You will rarely need anything else. The provider pages for Gmail and Google Workspace and Microsoft 365 list the exact server names.

Every email port in one table

PortProtocolEncryptionUsed for
25SMTPSTARTTLS when both servers support itMail servers delivering to each other
587SMTP submissionSTARTTLSApps and email clients sending mail (the standard)
465SMTP submissionSSL/TLS from the startApps and email clients sending mail
2525SMTP (unofficial)Usually STARTTLSA fallback some sending services offer
993IMAPSSL/TLSReading mail, kept in sync with the server
143IMAPSTARTTLSOlder IMAP port
995POP3SSL/TLSDownloading mail to one device
110POP3STARTTLSOlder POP3 port

SMTP ports: 25, 587, 465 and 2525

Port 25: server to server

The original SMTP port, defined in RFC 5321. When your provider delivers an email to the recipient’s mail server, it connects on port 25. Because spam once poured out of infected home computers on this port, many internet providers and cloud hosts block outgoing connections to it. Apps should not use it.

Port 587: the standard for sending

Set aside for message submission in RFC 6409. The app connects, upgrades the connection to encrypted with STARTTLS, then signs in. Microsoft 365, Gmail and almost every provider support it.

Port 465: encrypted from the first byte

465 has a messy history: it was assigned, withdrawn, and then made official again for submission in RFC 8314 in 2018, which recommends encryption from the start. Gmail supports it; Microsoft 365 lists 587 instead.

Port 2525: an unofficial fallback

Not part of any standard, but some email sending services accept it when 587 and 465 are blocked. Mailbox providers like Gmail and Microsoft 365 do not use it.

IMAP and POP3 ports

IMAP keeps mail on the server and in sync across every device, which is what sending tools need to read replies and run warm-up. Use 993. POP3 downloads mail to one device and is rarely used now; its encrypted port is 995. The older ports 143 and 110 start unencrypted and upgrade with STARTTLS. For how the protocols differ, see what SMTP is, and SMTP vs IMAP vs POP3.

STARTTLS or SSL/TLS?

Both end with an encrypted connection. STARTTLS (ports 587, 143, 110) connects in plain text and then upgrades. SSL/TLS, also called implicit TLS (ports 465, 993, 995), is encrypted from the first byte. RFC 8314 recommends implicit TLS where possible, but both are secure when the app insists on encryption. The one thing to avoid is a setting that allows the connection to continue unencrypted.

Ports for Gmail and Microsoft 365

ProviderSMTPIMAPPOP3
Gmail and Google Workspacesmtp.gmail.com, 587 or 465imap.gmail.com, 993pop.gmail.com, 995
Microsoft 365smtp.office365.com, 587outlook.office365.com, 993outlook.office365.com, 995
Outlook.com and Hotmailsmtp-mail.outlook.com, 587outlook.office365.com, 993outlook.office365.com, 995

Testing whether a port is blocked

If an app times out, check whether your network lets the connection through. On Mac, Linux, or Windows with OpenSSL installed, these commands open an encrypted connection and print the server’s greeting:

openssl s_client -connect smtp.gmail.com:465 -crlf -quiet
Port 465: encrypted from the start
openssl s_client -starttls smtp -connect smtp.office365.com:587 -crlf -quiet
Port 587: plain connection upgraded with STARTTLS

A line starting with 220 means the port is open. If the command hangs and times out, something between you and the server is blocking it: try the other port, another network, or ask your network admin.

Frequently asked questions

What is the default SMTP port?

Port 25 is the original SMTP port and is still used between mail servers. For sending from an app or email client, the standard ports are 587 with STARTTLS and 465 with SSL/TLS.

Should I use port 587 or 465?

Use whichever your provider lists. Both are encrypted and both are standard for sending from an app. Microsoft 365 uses 587; Gmail accepts both.

What port does IMAP use?

993 with SSL/TLS. Port 143 is the older port that starts unencrypted and upgrades with STARTTLS; most providers now expect 993.

Why is port 25 blocked?

Many home internet providers and cloud hosts block outgoing port 25 to stop infected computers sending spam directly. Apps should send on 587 or 465 instead, which require signing in.

What is port 2525?

An unofficial alternative that some email sending services offer when 587 and 465 are blocked. It is not part of the standards and mail providers like Gmail and Microsoft 365 do not use it.

Your next campaign could be sending by the end of the week.

Create a free account, build your order in a few minutes and request a quote. You only pay when you are happy with it.