SMTP Ports Explained: 25 vs 587 vs 465 and Which One You Should Use
Ask a room of email administrators which SMTP port to use and you will start an argument that has been running, in one form or another, for decades. Port 25 is the original. Port 587 is the modern submission standard. Port 465 was deprecated, then un-deprecated. Each has a distinct job, a distinct security model and a distinct set of traps for the unwary. Choosing the wrong one does not just risk a failed connection — it can mean credentials sent without the protection you expected, mail refused by your provider, or a server configuration that quietly invites abuse.
This guide explains what each SMTP port actually does, how encryption works on each, which port to use in every common situation, and how to troubleshoot the port problems that senders hit most often.
First, a Crucial Distinction: Relay vs Submission
Almost every port confusion dissolves once you understand that SMTP does two different jobs. The first job is relay: one mail server handing a message to another mail server for delivery to the recipient's domain. This is server-to-server traffic between strangers, and it traditionally happens without either side knowing the other's users. The second job is submission: a mail client or application — Outlook, a phone, your website's contact form, your sending platform — handing a message to its own server, authenticated as a known user, asking that server to deliver it on its behalf.
Relay and submission have opposite trust models. Relay must accept mail from the whole internet, so it cannot demand a password from every connecting server. Submission is a private service for your own users and systems, so it should always demand authentication. The port numbers exist largely to keep these two jobs apart, so that each can be secured appropriately. Whenever you are deciding on a port, first ask: is this machine relaying to other servers, or submitting as a client? The answer picks the port almost by itself.
Port 25: The Original Relay Port
Port 25 is where SMTP began and it remains the standard port for server-to-server relay. When your server delivers a message to Gmail or Microsoft, it connects to the recipient server's port 25, because that is where receiving servers listen. Nothing else can replace it for this job: if you run a mail server, port 25 inbound is how the world delivers mail to you, and port 25 outbound is how you deliver to the world.
Why port 25 is blocked so often
The same openness that makes port 25 essential makes it the favourite tool of spam botnets. A compromised home computer can, in principle, connect directly to any mail server on port 25 and spew spam. To choke that off, most residential ISPs block outbound port 25 entirely, and many cloud and VPS providers block or restrict it by default until you ask for it to be opened and justify the request. This is not your provider being difficult; it is one of the most effective anti-spam measures ever deployed. The practical consequences:
- Never use port 25 for submission from end-user devices or applications on ordinary connections — it will fail unpredictably as networks block it.
- If you run a real mail server, confirm outbound port 25 is open before you migrate, and be ready to demonstrate good sending practice (authentication records, reverse DNS, abuse handling) when you request it.
- Inbound port 25 is also a responsibility: a receiving server on port 25 must be hardened, because it is the most scanned and attacked service on the internet after web ports.
Encryption on port 25
Port 25 supports opportunistic TLS via STARTTLS: the connection starts in plain text and upgrades to encryption if both sides support it. Opportunistic is the key word — if the upgrade fails, traditional behaviour is to deliver in plain text anyway, because historically deliverability beat confidentiality for relay. Mechanisms such as MTA-STS and DANE exist to make that encryption enforceable, and large receivers increasingly publish them, but the baseline port 25 model remains "encrypt if possible". That is acceptable for relay between servers; it is not the model you want for your users' passwords, which brings us to submission.
Port 587: The Submission Standard
Port 587 is the message submission port, and it is the correct answer for the vast majority of "which port should I use?" questions. When your email client, website, CRM or application sends through your SMTP service, it should almost always connect to port 587. The submission service on 587 is built around three expectations that relay does not have:
- Authentication is required. The client logs in with a username and password (SMTP AUTH) before the server will accept mail. Your server is not an open relay for the world; it is a service for identified senders.
- Encryption is expected. Port 587 uses STARTTLS, and a properly configured submission service refuses authentication until the connection has been upgraded to TLS. Credentials never cross the network in plain text.
- The server fixes up the message. Submission servers conventionally add missing Date or Message-ID headers and apply your DKIM signature — the finishing touches that make authenticated, well-formed mail.
Because 587 was designed for clients, ISPs and corporate networks generally leave it open even where port 25 is blocked. If you are configuring any application to send through an SMTP service — a shop sending order confirmations, a scanner sending documents, a monitoring system sending alerts — start with 587, STARTTLS and authentication, and you will be right almost every time.
Port 465: The Comeback Port
Port 465 has the strangest biography in email. It was briefly registered for SMTP over implicit TLS — where the connection is encrypted from the very first byte, like HTTPS — then the registration was revoked in favour of STARTTLS on 587, and 465 spent years in official limbo while mail clients kept supporting it anyway. Eventually common sense caught up: implicit TLS is simpler and safer (there is no plain-text moment in which a downgrade attack can strip the encryption), and port 465 was formally re-registered for message submission over TLS.
Today, 465 is a perfectly good choice when both sides support it: many providers offer submission on both 587 (STARTTLS) and 465 (implicit TLS), and either is secure when configured correctly. The practical guidance is simple. Prefer 587 as your default because it is the universal standard; use 465 when a legacy application only supports implicit TLS (often labelled "SSL" in older settings screens), or when your provider recommends it. What you must never do is confuse the two modes: a client set to STARTTLS connecting to 465, or set to SSL/TLS connecting to 587, will fail with errors that look like server problems but are really a mismatch in how the conversation starts.
The Other Ports You Will Meet
- Port 2525 is not an official SMTP port at all, but many SMTP services listen on it as an alternative submission port, precisely because it is rarely blocked by networks that interfere with the standard ones. If 587 is unreachable from a restrictive network, 2525 (usually with STARTTLS and authentication, exactly like 587) is a legitimate workaround offered by your provider — not a standard to rely on elsewhere.
- Ports 110, 143, 993 and 995 are for reading mail (POP3 and IMAP), not sending. They appear in the same settings screens and cause endless confusion. If a guide tells you to enter 993 for outgoing mail, it is wrong.
- Port 26 and other provider-specific alternates exist on some shared hosts. They work only with that host's service and follow whatever rules the host sets.
Decision Table: Which Port, When
- Server delivering to other servers (relay): port 25, opportunistic STARTTLS, no authentication.
- Email client or app sending through your SMTP service: port 587 with STARTTLS and SMTP AUTH. Fall back to 465 with implicit TLS if the software demands it.
- Website or CMS sending notifications: 587 authenticated — never unauthenticated local relay if the site shares hosting with other tenants.
- Legacy device (printer, scanner, old monitoring tool) with only an "SSL" option: 465.
- Network blocks your first choice: ask your provider about 2525 or 465 before concluding the service is down.
- Anything asking you to submit on port 25 with a password: treat as a red flag and re-check the provider's documentation.
Troubleshooting Port Problems
Most "SMTP not working" tickets are port problems in disguise. Work through them in order. Connection refused or timeout on 25 almost always means a block — the ISP, the cloud provider or a firewall — rather than a down server; test 587 to prove connectivity. "Must issue STARTTLS first" errors mean the client tried to authenticate before encrypting, which a correct submission server forbids; enable STARTTLS in the client. Handshake failures on 465 usually mean the client was set to STARTTLS instead of implicit SSL/TLS. Authentication accepted on the LAN but not remotely suggests the submission service is only bound to localhost or a firewall rule covers only some ports. And if everything connects but mail vanishes, check that you have not configured the receiving/relay port in an application that needed submission — mail handed to the wrong service can be accepted and then dropped by policy. A two-minute test with a tool like openssl s_client or a simple telnet-style connection to each port, comparing the banners and the response to EHLO, will usually show you exactly which services your server is really offering.
A Worked Example: Reading a Real Configuration
Theory becomes clearer with a concrete case. Imagine your online shop needs to send order confirmations through your SMTP service, and the settings screen offers four fields: host, port, encryption and authentication. The host is your server's mail hostname. For the port you enter 587, because the shop is submitting mail as an authenticated client, not relaying. For encryption you choose STARTTLS (some software labels this simply "TLS"), because that is how 587 expects the conversation to be protected. Authentication is switched on, with the dedicated username and password created for the shop — not your personal mailbox password, and not an administrator account. Save, send a test order, and then verify in the received message's headers that DKIM passed and the sending IP is the one you expect. Total time, once you know the model: a few minutes.
Now change one variable: the same shop moves to a host whose outbound network blocks port 587 for some reason. The wrong response is to fall back to port 25 without authentication "because it connects" — you have just taught your shop to behave like a stranger relaying mail, and many receiving paths will treat it accordingly, if the connection is allowed at all. The right response is to check whether your SMTP provider offers 465 or 2525, switch the port and (for 465) the encryption mode to implicit TLS, and keep authentication on. The model did not change; only the door you knocked on did. Ninety percent of port troubleshooting is keeping that distinction straight while everyone around you is just trying numbers until something connects.
What About Sending From a VPS?
If you run your own mail stack on a virtual server, ports become an infrastructure question as well as a settings question. Your VPS must be able to make outbound connections on port 25 or it cannot deliver mail directly to the internet, no matter how beautifully it is configured — and as covered above, many VPS providers restrict that port until you open a ticket. Plan for this when you provision: confirm the provider's port 25 policy, expect to explain your use case, and understand any volume conditions they attach. While you wait, a smart host or relay configuration through your provider's submission service on 587 keeps mail flowing. Choosing infrastructure with a clear, mail-friendly port policy from the start — rather than discovering the block during your first campaign — is one of the quiet differences between a frustrating setup and a boring one, and boring is exactly what you want from email plumbing.
Securing the Ports You Open
Every listening port is a door, so finish the job properly. Your port 25 service should rate-limit, reject obvious abuse and never relay for unauthenticated strangers — an open relay will be found and exploited, and your IP reputation will pay for it. Your submission ports should require authentication over TLS, use strong unique credentials per application (so a leaked website password can be revoked without breaking everyone), and be the only path by which your users send. Keep your server software updated, because SMTP daemons are high-value targets. And document your own standard — "we submit on 587, relay on 25, 465 for legacy" — somewhere your team can find it, because the next person configuring a scanner at 6pm will otherwise guess, and guessing is how port folklore starts.
If you would rather not assemble and secure all of this yourself, that is exactly the work a managed sending platform does for you. goIX's dedicated SMTP servers come with submission and relay configured correctly, authentication records set up, and support that can tell you which port your application should use before you waste an afternoon guessing. Pick a plan, plug in port 587, and get back to sending.