A common question for anyone configuring an app or mail system to send (or relay) email is “what SMTP port should I use?” Let’s run through the different ports commonly used for sending email today.
(TL;DR: If you’re configuring your systems to use SparkPost as an SMTP relay, you should use port 587, with 2525 as an alternate in certain circumstances when port 587 is not available.)
Any SMTP Port in a Storm
Email, like every other system that connects over a network like the Internet, uses the concept of addresses to determine where a system can be found. 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 220.127.116.11. But not as many of use know that these network addresses also include specific “port numbers” that are a little bit like an apartment number in a real-world street address.
For example, the web and HTTP use port number 80. For email and SMTP that port number is… well, it depends. You might see information that tells you to use ports 25, 465, 587, or 2525 for SMTP. Which SMTP port should you use? Here are the details about the most common SMTP ports.
If you’re a systems administrator of a certain age, you know the answer used to be straightforward: SMTP was designated 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 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.
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.)
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 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.