**This post was updated on 5/23/2018
What SMTP Port Should I Use?
A common question for anyone configuring an app or mail system to send (or relay) email is “what SMTP port should I use?” You might see information that tells you to use ports 25, 465, 587, or 2525 for SMTP. So, which of these should be your standard SMTP port? Here’s what you need to know, and why.
(TL;DR: If you’re configuring your systems to use SparkPost as an SMTP relay, you should use port 587 as your standard SMTP port, with 2525 as an alternate in certain circumstances when port 587 is not available.)
What is an SMTP Port?
SMTP (Simple Mail Transfer Protocol) is the basic standard that mail servers use to send email to one another across the internet. SMTP also is used by applications such as Apple Mail or Outlook to upload emails to mail servers which then relay them to other mail servers. (On the other hand, mail apps typically rely on other standards such as IMAP or POP3 to retrieve emails from servers.)
Like other Internet services such as web sites, SMTP email relies on domain names and Internet addresses to know where to send messages. All of us today are familiar with the textual version of these addresses, like www.sparkpost.com. And most of us know that an easy-to-remember text address stands in for a numeric IP address like 126.96.36.199. But not as many of use know that these network addresses also include specific “port numbers.” An “SMTP port” refers to the specific part of the Internet address that’s used to transfer email.
Here’s a simple analogy: if a domain name is something like the street address of a large office building that houses a number of services or businesses, a port number is like the suite number for a particular business. And so the SMTP port is like the office number for the mailroom or a package shipping business at a particular street address.
The web and HTTP use port number 80. For email and SMTP, that port number is… well, it depends.
What is the Standard SMTP Port?
Good question. As I mentioned earlier, you’ve probably seen information that tells you to use ports 25, 465, 587, or 2525 for SMTP. Each of these have been considered standard SMTP ports at some point—but only two of these, 587 or 2525—really should be considered for modern use. I’ll explain why as we run through the different ports commonly used for sending email today.
Common SMTP Port Numbers
Today, the most common SMTP ports are 25, 465, 587, or 2525.
|Port Number||Description||When to Use It|
|25||Standard SMTP port||Often blocked by ISPs and cloud providers.|
|465||Out-of-date (deprecated) port for secure SMTP||Do not use unless absolutely necessary.|
|587||Modern port for secure SMTP||The best choice for SparkPost and modern apps.|
|2525||Alternative, non-standard SMTP port||An alternative in cases when standard ports are not available.|
Port 25: The Original Standard SMTP Port
If you’re a systems administrator of a certain age, you know the answer used to be straightforward: SMTP was designated to use port 25 in IETF Request For Comments (RFC) 821. Today, the Internet Assigned Numbers Authority (IANA), the group responsible for maintaining the Internet addressing scheme, still recognizes Port 25 as the standard, default SMTP port. But in practicality, it’s not as simple as it seems.
Although port 25 continues to be used for server-to-server SMTP relaying, most modern SMTP clients should not be configured to use this port, because Port 25 usually is blocked by residential ISPs and business cloud hosting providers alike. Why? Thank the spammers. Port 25 is blocked on many networks to curb the amount of spam that is relayed from compromised computers or servers. Unless you’re specifically managing a mail server, you should have no traffic traversing this port on your computer or server.
Port 465: Deprecated and Out-of-Date SMTP Port
IANA initially assigned port 465 for an encrypted version of SMTP called SMTPS. However, IANA since has reassigned this port for a different use, so it should no longer be used for SMTP.
However, because of this brief historical use, there are some legacy systems that still use port 465 for SMTP, and some help pages on the Internet still suggest port 465 as the recommended setup. Our advice? Don’t do it unless your application absolutely requires it—port 465 is no longer an accepted standard for SMTP. (By the way, that’s why SparkPost does not accept connections on port 465.)
Port 587: The Standard Secure SMTP Port
Modern email servers use port 587 for the secure submission of email for delivery. For example, if you use an email client software like Outlook or Apple Mail, it most likely is configured to use this port to send your messages. It’s not just personal email client software, however. Systems that transmit messages to an email delivery service like SparkPost also should be configured to use this port.
All SparkPost customers should use port 587 as default, unless you’re explicitly blocked by your upstream network or hosting provider. Using port 587, coupled with TLS encryption, is the best way to ensure that email is submitted securely and reliably to SparkPost (or nearly any other provider).
Port 2525: A Common Alternate SMTP Port
Port 2525 is not an official SMTP port, and it is not sanctioned by the IETF nor IANA. However, SparkPost and many other email service providers support the use of port 2525 as an alternative to port 587 for SMTP, in the event the above ports are blocked. (One notable example where this is required is for services hosted on Google Compute Engine.) If you’ve tried port 587 but experience connectivity issues, try port 2525. Just like port 587, most implementations that listen on port 2525 also support TLS encryption.
In summary, SMTP port 587 is the best choice for nearly every use case for connecting to SparkPost and other email delivery services.
I hope this information helped you learn a little more about which SMTP port to use! Want to learn more about using SMTP? Here are instructions for configuring SparkPost for SMTP relay and email delivery, the differences between SMTP and API message transmission, and troubleshooting your SMTP connection to SparkPost.