SMTP Port Numbers Explained: Which Should You Use?

Last updated: November 24, 2026

Send mail from an email app on port 587 with STARTTLS or port 465 with implicit TLS. Use whichever your provider documents, always with a login, and leave port 25 to servers handing messages to each other.

You've added a laptop to the business, opened the mail app, typed the address and password, and hit a field labelled Port. A tutorial says 25. You type it, the spinner runs, and a minute later you get a timeout. Nothing about the password was wrong. The number sent your app to a service that was never built to talk to it.

Port numbers look like trivia until one of them costs you an afternoon. Each number belongs to a specific job, a specific encryption setting and a specific authentication rule, and the errors you get when those three don't line up are predictable once you know the pattern.

What Are SMTP Port Numbers?

Picture the setup screen. Server name, username, password, and a small box marked Port, usually pre-filled with 587 or 465 and sometimes with 25 in an older guide. That number tells your mail app which service on the server to knock on.

SMTP stands for Simple Mail Transfer Protocol. It's the set of rules an email app or a mail server follows to hand a message onward toward its recipient. A port is a numbered channel on a machine. If the server is an office building, the port is the suite you walk into. Several suites can run different businesses, and only one of them handles outgoing mail for your app.

A single mail server often runs two SMTP services at once. One faces the public internet and accepts mail from other mail servers. The other faces your users, demands a login, and accepts mail from apps. Same protocol, different job, different door.

Quick reference for the four SMTP ports

Port Main job Encryption setting Who sends on it
25 Server-to-server mail transfer STARTTLS, often optional on the receiving server Mail servers only
587 Authenticated client submission STARTTLS, enforced before credentials are sent Email apps and devices
465 Submission with implicit TLS TLS from the first byte Clients that require encryption from the start
2525 Alternate submission when standard ports are blocked Set by the provider, often STARTTLS Apps on restricted networks

Three of those numbers, 25, 587 and 465, are recognized standard assignments. Port 2525 isn't. It's an informal alternate that some providers offer, and that difference matters when you're troubleshooting.

The rule everything else in this article builds on is simple. Match the port to the job in front of you, not to the number a tutorial happened to print.

Port 25 and Server-to-Server Mail Transfer

Port 25 is the original SMTP port. When one mail server holds a message for a domain it doesn't host, it opens a connection to the recipient's mail server on port 25 and reads the sender, the recipient and the message body down that channel. Each hand-off between mail servers happens this way, which is why port 25 traffic looks nothing like the traffic from your laptop.

The Canadian Centre for Cyber Security identifies SMTP as the protocol mail servers use and recommends secure configuration between Message Transfer Agents, the software that moves mail from one server to the next, as set out in its guidance on securely configuring network protocols. That guidance also notes SMTP traffic can be upgraded with STARTTLS under RFC 3207, which gives administrators a defined method for negotiating encryption mid-connection.

Why port 25 gets blocked

Port 25 historically accepted mail without asking who was sending it. Spammers and infected machines exploited that to push bulk mail straight out, so residential internet providers and cloud hosts began blocking outbound traffic on 25 for their customers. The block is blunt and effective. An infected laptop on a home connection can't spray mail directly at the world.

The cost lands on anyone following an old guide. A website contact form, an office printer that scans to email, or a desktop client set to port 25 will hang and then time out, because the connection never leaves the network.

The rule for anything that isn't a mail server

Your application shouldn't treat port 25 as a general-purpose sending port. Use the submission service your email provider specifies, and require authentication on it. Port 25 belongs to the mail server's own relay, not to the app you're configuring.

Federal guidance in Canada treats SMTP as core infrastructure to be watched rather than merely connected. Innovation, Science and Economic Development Canada lists SMTP mail services alongside DNS resolution and network time synchronization as part of providers' core IT infrastructure, and recommends monitoring outbound message volumes, unusually high numbers of intended recipients, and spam-related traffic from individual customer IP addresses (CSTAC security best practices). For a business running its own relay, that's the shape of a port 25 control set: watch the volume, cap it, and publish reverse DNS so receivers can tell who you are.

When a receiving server can't confirm the sending machine belongs to your domain, delivery slows down or stops. Our guide to how MX records route email covers the lookup that happens before any of this.

Practical check: If a setup guide tells you to put port 25 in a printer, a form or a desktop app, confirm with your provider before you use it. The answer is almost always a submission port with a login.

Port 587 and Port 465 for Client Submission

Two ports handle the first hop, the one from your app to your provider's mail server. They do the same job in opposite orders, and that difference explains most of the confusion around them.

Port 587 and the STARTTLS upgrade

Port 587 exists because relay and submission are different jobs. It's the standard submission port, the one an email app uses to hand a message to its own provider for delivery. Separating it from port 25 kept new submission policies from interfering with server-to-server relay.

The conversation runs in a fixed sequence. Your app connects in plain text and says hello. The server advertises what it supports, including STARTTLS. The app issues the STARTTLS command, both sides perform a TLS handshake and exchange keys, and from that point the session is encrypted. Only then does the app send the username and password.

That order is the whole point. The password crosses the wire after encryption begins, not before. The Cyber Centre describes the same sequence and adds a warning worth keeping: TLS can protect the initial transfer from an email client to its first server, while later server-to-server transfers might not use TLS at all, as explained in its email security best practices. TLS protects data in transit, and the sending and receiving servers can still read the message in plain text. It isn't end-to-end encryption.

Port 465 and implicit TLS

Port 465 skips the upgrade entirely. The TLS handshake happens before a single SMTP command is exchanged, so the connection is encrypted from the first byte and there's no plaintext window at all. The IETF restored it as a submission port for exactly this purpose in RFC 8314, and any client whose dropdown only offers "SSL/TLS" is asking for it.

There's no negotiation and no fallback. If the handshake fails, the connection fails. Some people read that as fragility. It's in fact a clear signal, because nothing gets sent in the clear.

Why the number isn't the security setting

The idea that 465 is weaker than 587 has outlived its reason. What protects your password is enforced encryption plus a certificate your client validates, and both ports can deliver that. A 587 setup that falls back to plaintext without warning is the weaker of the two.

The settings you'll see in a client look like this. For 587: the server name from your provider, port 587, encryption set to STARTTLS, normal password. For 465: the same server name, port 465, encryption set to SSL/TLS, normal password.

Where the setup goes wrong

  • Encryption off on 587. The app connects, skips the upgrade, and sends credentials in the clear.

  • SSL/TLS selected on 587. The client tries a TLS handshake on a port that expects plaintext first, and you get a "wrong version number" error.

  • Certificate name mismatch. The hostname you typed doesn't match the certificate, usually because someone used an old or unofficial server name.

  • A network blocking the port. Hotel, airport and some corporate networks block 465 and 587 outright, which shows up as a timeout rather than an authentication failure.

Send a test message to a second account you control and read the Received headers. A line naming the TLS version confirms that hop was encrypted. If there's no such line, it wasn't.

Port 2525 as a Backup Submission Port

Port 2525 isn't registered with IANA for SMTP and has no standard behind it. Some providers accept submission on it anyway, as an alternate that mirrors their 587 service.

The situation it solves is specific. You're in a hotel room or an airport lounge, the network blocks 25, 465 and 587, and your mail app times out on every standard setting. Port 2525, being an unusual high number, often gets through.

Nothing else about the rules changes. It still requires authentication, it still requires encryption, and it still has to refuse relaying for anyone who hasn't logged in. A provider that opens 2525 as an open relay has made the problem worse, not better.

Use 2525 only when your provider documents it. A port that answers doesn't prove it's the right service, and an undocumented listener is not something to hand your password to.

Check the provider's settings page before you try it. If 2525 isn't listed there, ask support rather than guessing. It's a fallback, not a first choice, and it shouldn't be the setting you hand to your whole team as standard.

One more thing worth knowing. Port 2525 doesn't change what happens after the hand-off. If a message is going to be rejected for a bad SPF record or a missing login, moving ports won't save it. The port decides whether you can talk to the server. The server still decides whether to accept the message.

How SMTP Ports Affect Email Security

A professional woman working on a laptop computer displaying an email interface at a sunlit office desk.

A port decides which service you reach and what that service expects from you. It doesn't decide whether the message is trustworthy. Those are separate questions, and blurring them is how people end up believing a port change fixed a phishing problem.

Three questions cover the security of any send. Is the connection encrypted? Is the sender authenticated to the server? Can the receiving domain verify who sent the message? Each has its own control, and each can fail on its own.

Authentication and risk for each SMTP port

Port Authentication required Main risk if misconfigured Control that addresses it
25 Usually none between trusted mail servers Open relay used to send spam Connection controls, rate limits, reverse-DNS checks, anti-abuse monitoring
587 Yes, username and password Credentials exposed if STARTTLS is not enforced Advertise STARTTLS before accepting credentials, disable unauthenticated relaying
465 Yes, username and password Client accepts an unvalidated certificate Enforce certificate validation in the client
2525 Yes, if the provider requires it Unofficial service with an unclear policy Use only when the provider documents it

The first question is the port's own business. The second belongs to the submission service, which should refuse to relay for anyone who hasn't logged in. The third has nothing to do with ports at all.

Why a port change won't stop phishing

The Canadian Anti-Fraud Centre reported more than CAD 68 million in spear-phishing losses in 2025, and nearly CAD 31 million in reported losses during the first three months of 2026 (Canadian Anti-Fraud Centre). That threat is impersonation and social engineering, and an exposed or blocked port doesn't create it.

The domain controls that do the work

The Government of Canada's configuration requirements call for SPF authorization of all sending IP addresses, DKIM signatures on all outbound messages, and DMARC reporting for government email domains, beginning at a minimum policy of p=none and phasing toward p=quarantine or p=reject according to departmental risk (Government of Canada email configuration requirements). Aggregate reports go to the Canadian Centre for Cyber Security, which gives the public sector a monitoring channel for authentication failures.

Run the same sequence on your own domain. Publish SPF and DKIM, start DMARC at p=none, read the reports for a few weeks, then move to quarantine and finally reject. Enforcement is what stops a spoofed message, not observation.

The Cyber Centre's quick guide to email configuration also recommends that mail transfer agents support TLS and use MTA-STS in enforce mode or DANE, so an attacker can't strip encryption between servers unnoticed. STARTTLS upgrades a connection when both sides cooperate. These records are what stop a downgrade when they don't. For a closer look at how TLS wraps a message on its way out, our guide to SSL mail and email encryption walks through the mechanics step by step.

Typewire fully encrypts email in transit and at rest, but encryption on our side can't fix a missing SPF record on yours. Those DNS records are yours to publish, and they're what a receiving server checks before it decides to trust the message.

Which Port to Choose for Your Setup

Sort the situation first, then pick the number. The port is a consequence of what you're configuring, not a preference.

Which SMTP port and setting fits your situation

Situation Port Encryption setting Extra requirement
Desktop or mobile email app 587 STARTTLS, enforced Username and password, using the full email address as the username
Client that only offers SSL or TLS 465 Implicit TLS Validate the server certificate
Mail server relaying to other domains 25 STARTTLS Reverse DNS, rate limits, anti-abuse monitoring, no open relay
Network blocks 25, 465 and 587 2525 As documented by the provider Only where the provider publishes it
Website form, printer or internal app 587 STARTTLS Never port 25, always an authenticated submission service

An infographic titled Which SMTP Port to Choose comparing the usage of port 587, 465, and 25.

Four rules cover almost everything. A desktop or mobile app sends on 587 with STARTTLS and a password. A device that only offers implicit TLS uses 465 with SSL/TLS. A mail server delivering to other domains uses 25 with STARTTLS, plus reverse DNS, rate limits and abuse monitoring. A restricted network may allow 2525, but only if your provider documents it.

The split between message transfer and message submission is the point of all this. Port 25 is a server-to-server job: it assumes the machine answering is a mail server with its own hostname, its own DNS records and its own abuse controls. Submission ports assume the opposite. On 587 or 465, the server expects a person or an application logging in with a username and password, one account at a time.

Transport encryption protects the connection while it's open, and it doesn't authenticate the sending domain or give you end-to-end confidentiality. That is why port selection sits alongside SPF, DKIM and DMARC rather than replacing them. Picking 587 correctly encrypts the hop. The DNS records are what tell the receiving server the message really came from your domain.

A checklist you can run today

  1. Confirm the port your provider documents, not the one in the tutorial.

  2. Set encryption to STARTTLS on 587, or SSL/TLS on 465.

  3. Turn on authentication and use your full email address as the username for both the incoming and outgoing server.

  4. Publish SPF, DKIM and DMARC records for your domain.

  5. Send a test message to a second account and read the headers to confirm encryption.

Step 3 is the one that bites. A mail app that asks for a username often pre-fills it with just the part before the @ sign, and the connection fails even though the password is correct.

In a Typewire account, IMAP and SMTP access is switched on under Settings, then Mail settings, then IMAP and SMTP. If you're adding the account to Thunderbird, the username for both the incoming and outgoing server has to be the full Typewire email address. Type the full address in both fields, even when the client fills in something shorter by default.

Whatever you're migrating from, the checklist stays the same. Setting up an email migration to Typewire takes only a few minutes, and the port rules above apply to the new account the same way they applied to the old one.

Your incoming settings matter too. Our guide to finding the right IMAP port number for secure email covers the receiving side, which uses different numbers entirely.

Troubleshooting SMTP Port Errors

Most SMTP port failures produce one of five messages. Match yours and skip the rest.

  1. Connection timed out. The network or provider is blocking the port. Try 587 first, then 2525 only if your provider documents it.

  2. Connection refused. Nothing is listening on that port, or a firewall is dropping the traffic. Re-check the hostname and port on the provider's settings page.

  3. ssl routines wrong version number. The client is set to SSL/TLS on a STARTTLS port. Switch encryption to STARTTLS.

  4. 530 5.7.0 Authentication required. Authentication is off or the username is wrong. Use the full email address, not the part before the @ sign.

  5. Certificate name mismatch. The hostname you typed doesn't match the certificate. Use the server name your provider publishes.

Two commands settle the encryption question faster than any dropdown. Running openssl s_client with the -starttls smtp option against port 587 performs the upgrade and prints the certificate chain, so you can read the name and the expiry date. Pointing the same command at port 465 does the handshake before any SMTP command and shows you what implicit TLS really returns.

An EHLO reply that lists STARTTLS confirms the server advertises the upgrade. A bare telnet check against port 587 only proves something answers on that port. It tells you nothing about whether encryption or authentication will work once you're through.

Frequently Asked SMTP Port Questions

Q: Which port should I use to send mail from an app?

A: Port 587 with STARTTLS and authentication covers most apps. Port 465 with implicit TLS works just as well, and it's the better choice when your provider recommends it or your client only supports it. Check the provider's settings page before trying anything outside those two. The port tells the client how to start the connection. Authentication tells the server who is sending. The encryption mode decides when TLS begins.

Q: Is port 25 blocked in Canada?

A: Many residential internet providers and cloud hosts block outbound 25 to curb spam from compromised machines. Server-to-server relay still needs 25, and that traffic is protected with reverse DNS, rate limits and monitoring rather than by moving it elsewhere. Think of 25 as the highway between mail servers. If one end has weak sender records or poor reputation controls, changing the exit ramp will not fix the problem.

Q: Does changing the SMTP port stop phishing or spoofing?

A: No. Port changes reduce relay abuse, but the losses reported to the Canadian Anti-Fraud Centre come from impersonation and social engineering, which a port number doesn't touch. SPF, DKIM and DMARC address sender identity, and DMARC needs to reach enforcement for that protection to count. A message can travel over a properly encrypted SMTP connection and still be a fake invoice from someone pretending to be your supplier.

Q: Is port 465 less secure than 587?

A: Not when TLS is enforced and the certificate is validated. Both ports encrypt the connection. They only start the encryption at different points in the conversation. With 465, TLS begins before SMTP commands. With 587, the client connects first, then uses STARTTLS to upgrade the session.

Q: Can I use port 2525 anywhere?

A: Only where your provider documents it. It has no standard assignment, and an undocumented listener on that port isn't something to hand credentials to. Treat it like a side door. It may be useful when a network blocks the usual submission ports, but only when the provider says the door is really there.

Q: Is port 587 encrypted?

A: Only after STARTTLS succeeds and the server requires it. If the client allows a fallback to plaintext, your password can cross the wire unencrypted. That is why the encryption setting matters as much as the number in the port field. A correct port with weak client settings gives you the shape of a secure connection without the protection.

Typewire is a Canadian private email provider based in Vancouver. We run our own servers rather than renting cloud capacity, host mail under Canadian law with no ads and no tracking, and fully encrypt email in transit and at rest. Basic, Premium and Family plans include IMAP and SMTP access, along with Android and iOS apps. Outbound email is rate-limited and filtered to help protect your sending reputation, with a design goal of near-100% email deliverability.

If you want Canadian email hosting on infrastructure we own and monitor ourselves, Typewire gives you a place to start without guesswork about ports on plans that include IMAP and SMTP. You can use a free personal email address or connect your own domain. The Premium plan supports up to 5 of your own domain names, with up to 50 email aliases per user that can be assigned to those custom domains. Start your 7-day Typewire free trial today.