**This post was updated on 5/23/2018
Which SMTP Port Should I Use: Port 25, 465, 587 or 2525?
People configuring an app or mail system to send (or relay) email often have a common question: “What SMTP port should I use?” You might see information that tells you to use ports 25, 465, 587, or 2525 for SMTP relay. So, which of these should be your standard SMTP port? Here’s what you need to know, and why.
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 is also used by applications such as Apple Mail or Outlook to upload emails to mail servers that 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. Most of us know that the text address stands in for a numeric IP address like 188.8.131.52. 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.
The web and HTTP use port number 80. For email and SMTP, that port number is… well, it depends.
Which port should you use for SMTP?
Ports 25, 465, 587, or 2525 for SMTP have all been considered standard SMTP ports at some point, but only 587 or 2525 really should be considered for modern use.
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 case port 587 is not available.
I’ll explain why as we run through the different ports commonly used for sending email today.
Port 25: The original standard SMTP port
Port 25 is the original standard SMTP port. 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. SMTP was designated to use port 25 in IETF Request For Comments (RFC) 821. 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 is usually blocked by residential ISPs and business cloud hosting providers alike.
Why is port 25 usually blocked? How can you check if it is?
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
Port 465 is no longer an accepted standard for SMTP. However, there are some legacy systems that still use port 465 for SMTP, and some help pages on the iInternet still suggest port 465 as the recommended setup. Our advice? Don’t do it unless your application absolutely requires it.
IANA initially assigned port 465 for an encrypted version of SMTP called SMTPS. However, IANA has since reassigned this port for a different use, so it should no longer be used for SMTP. This is 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.