Are you in the middle of setting up an SMTP service and just encountered a port field you don't know how to fill in?
We’ve got you covered, friends. In this blog post, we'll take a deep dive into SMTP ports. Let's get started.
What is an SMTP port? #
An SMTP port is a communication endpoint that handles the transfer of email data over SMTP (Simple Mail Transfer Protocol) as it moves through a network, from one server to another.
Ports play a crucial role in routing the right information to the right places. Whether you’re sending an email or browsing the web, any networked service requires two things to route communications appropriately: a domain name or internet address and a port. An IP address identifies a machine in an IP network, while ports identify particular applications or services on a system.
Different ports are reserved for different types of protocols and their associated functions, and port numbers help you identify these standardized ports. Web browsing, for example, uses ports 80 and 443. Port numbers 21 and 20 are used for FTP. And ports 25, 487, and 2525 handle SMTP.
An easy way to think about ports is that they’re like phone number extension codes. If you dial a company’s generic phone number (123-456-7890), you’ll likely get the front desk. But if you want to get to Customer Service, you’ll need their unique extension (like #400). Like a port, the extension connects your call and your specific type of request—in this case your customer support question—to the place that’s set up to handle your request.
Why is there more than one port for SMTP? #
Getting email from one email client to another involves a few steps: you need to submit that email from your client to the mail server, it’s then relayed from one server to the next, until it’s finally received by your recipient’s email client. For each step of this process, different ports come into play:
If you are configuring your own mail servers to accept mail from external systems (such as Gmail, Yahoo, etc), you’ll need to allow mail to be delivered on the standard port 25. This is the only port mail servers know how to use to transfer or relay mail.
However, the story is a bit different for mail submission...
When a mail client needs to submit a message to be relayed, they’ll usually connect on a different port. In many cases, this will be port 587. Even though the protocol between an email client and the server is the same (they’re both using SMTP), a different port is used.
Email receiving doesn’t happen via SMTP. IMAP or POP are the protocols used to receive email, and they again rely on different ports.
But if both email submission and relay happen through SMTP, why are there different ports? This is for a couple of historical reasons:
- As a way to avoid users generating spam and sending it over their networks, many internet service providers started blocking port 25 from sending mail to external systems. Since receiving servers generally only accept mail on port 25, this prevents a lot of malicious mail from being sent from consumer-level/residential connections.
- When a connection is made to a mail server, the server needs to determine whether the client intends to submit a message to be delivered to the mail server, or the client intends to have the server relay a message to another SMTP server. By using a different port, mail server administrators can add different restrictions and authentication requirements for each kind of interaction.
An SMTP service you can count on
Postmark’s SMTP service makes email delivery quick and easy for low- and high-volume sending.
Why your choice of SMTP port matters #
When you’re looking to connect to an SMTP service, you’ll have to check what ports that provider uses to listen to incoming emails. If you’re submitting your email to a port your provider doesn’t support, you simply won’t be able to send your emails.
To find the details you need about supported ports, check your providers’ SMTP documentation.
If you’re using Postmark as your SMTP service (💛), you can find the detailed SMTP documentation in our developer docs.
To support all possible use cases, we let you connect to Postmark using ports 25, 2525, and 587, but the one we’d recommend you to use is 587 (you might see that that’s the port we use in code snippets and in Postmark’s documentation).
If you choose to use port 25 or 2525 though, everything still works just fine.
Please note that we’re not supporting port 465. Why? Let’s look at the different ports in detail.
Most common SMTP ports: Overview and use cases #
SMTP port 25: The original default SMTP port for sending emails #
Way back in 1982, the Internet Engineering Task Force (IETF) published what would become a landmark document, named Request for Comments (RFC) 821. In it, the IETF established port 25 as the standard or default channel for transmitting email over the internet.
(You can still read this nearly 40-year-old communication online if you want to marvel at how far we’ve come.)
To this day, SMTP port 25 continues to be recognized as the default SMTP port for sending email, including by the Internet Assigned Numbers Authority. But that doesn’t mean you should use it. While it’s still technically the default, almost all modern email clients (including Gmail, Yahoo, and others) no longer use it.
Even worse, many ISPs and cloud services actively block traffic coming in over port 25: because it’s unsecured, it’s an easy path over which bad actors and malware bots send spam emails.
SMTP port 25 still has a legitimate role to play in SMTP relay, but you generally shouldn’t use it for SMTP to submit messages.
Bottom line: Unless you have a specific reason, you probably won’t need to use port 25.
SMTP port 465: A deprecated port you should no longer use #
Back in the 90s, the IANA began exploring a new method of encrypting or securing email over SMTP, which was called SMTPS. The intent was that SMTP email would be sent securely via standard encryption methods of the time, which were implicit Transport Layer Security (implicit TLS) and Secure Sockets Layer (SSL).
So, the IANA assigned SMTP port 465 for these protocols.
However, there was never a Request for Comments, so the IETF never signed on to this approach or officially endorsed this port. Eventually, other methods of sending encrypted mail (like STARTTLS) grew popular, so the IETF ended up making port 587 the standardized encryption protocol. The IANA changed their tune, removing port 465 from their registry, then later reinstating it for certain cases.
Why mention port 465 at all, then? Well, some legacy equipment and applications still use the port as the default for SMTP. Notably, some older Microsoft applications still do not support STARTTLS, which is why 465 hangs around in those programs.
Bottom line: Don’t use port 465 for SMTP if you don’t have to. Many modern hosting providers and email service providers block it or don’t support it (including Postmark).
SMTP port 587: The right choice for nearly every situation #
Port 587 was established as a modern secure SMTP port for message delivery. It supports TLS natively and STARTTLS as well, allowing for the secure submission of mail over SMTP.
The intent of establishing this port was to split the duties of mail submission from message relay. Mail submission would now happen over the more modern port 587, while mail relay would route through the older and less secure port 25.
Today, most modern email services, including email service providers and hosting providers, default to using SMTP port 587. So do mainstream email clients like Microsoft Outlook Express and Apple Mail. It’s the right choice for many scenarios, the most widely recognized and compatible port.
By this point in the guide, you’ve probably concluded that nothing is ever straightforward when it comes to SMTP. You’re right—there are a few limited scenarios where port 587 won’t do the trick.
A few hosting providers and upstream networks block this port. Google Compute Engine has changed its sending rules a few times, previously blocking port 587 for outgoing emails, and port 25 is always blocked.
Bottom line: For most senders, port 587 is the way to go. The encryption and wide acceptance make it an easy choice. It’s also the port we recommend that you use when submitting mail to Postmark.
SMTP port 2525: The ideal alternative when other ports are blocked #
Port 2525 has come to be the de facto alternative for modern SMTP use when port 587 is blocked. This is true even though neither the IETF nor IANA have granted it official status. Port 2525 is also considered a secure port, one that generally supports TLS encryption.
Bottom line: If you need to configure your email server and port 587 isn’t working, port 2525 is your ideal alternative.
Headache-free SMTP sending with Postmark #
Are you looking for a reliable SMTP service that gets your emails delivered, every time? With Postmark, you have an email partner you can count on. Just grab your account’s SMTP credentials (including the right port number—you’re an expert on that topic now!) and you’re ready to start sending.
Not sure if Postmark is the right fit for your sending needs? See how Postmark’s features, deliverability, and pricing compares to other SMTP services.