SMTP or Simple Mail Transfer Protocol is used to transmit emails between clients, receivers, and email servers. SMTP service generally provided via different ports for network communication and transmission. IMAP and POP3 are other protocols used for email transmission but they are mainly used by email clients where SMTP is used for email servers. In order to use email service to sent few or bulk emails, we should configure the email servers SMTP port properly.
What Is SMTP(Simple Mail Transfer Protocol)?
Simple Mail Transfer Protocol is a mail transfer protocol which is mainly used to transfer email between servers in a simple text based mechanism. E-mail servers and some email clients uses the SMTP for e-mail transfer and communication.
Before SMTP there are protocol like SNDMSG, Mail Box Protocol with the RFC 196 etc. SMTP is official standardized with the RFC 788 in November 1981. As the first SMTP standard this RFC used the port number 25.
As an old and popular protocol SMTP provides different port numbers for diffrent reasons and use cases. There is two main action in SMTP.
Submission is the act of submitting an email message and data to an outgoing email server. The email client connects to this outgoing email server and submits the email message and data.
Relay is the act of receiving and email message and data from a email server and transmit to the another email server. Generally the latest email server will be the receipent email server.
In order to complete these actions following different ports are used by SMTP. Below we will explain these different port in detail.
SMTP Port 25
Port 25 is the first official port of the SMTP. Port 25 is dedicated for the SMTP in 1982. SMTP Port 25 uses the TCP as a transmission protocol. Also, Port 25 is the most known and popular port for SMTP. As an old, popular, and well-known port Port 25 is abused widely and some ISP, Network, and Cloud providers automatically or by default blocks the TCP 25 SMTP port in order to prevent abuses and security attacks.
SMTP Port 587
SMTP Port 587 is the default port for email submission and used by a lot of parties. If you don’t know the default port of the remote email server the best choice to start check for submission is used the SMTP port 587. Port 587 is provided as a TCP port. Also, port 597 provides a secure email submission by using TLS encryption.
SMTP Port 465
SMTP port was the first secure and encrypted email submission port which is using SMTP over SSL methodology. After some time with the emerge of the Port 587 SMTP port 465 is deprecated officially and provided for use of other protocols. But today many ISP and cloud hosting providers support and provide port 465 for SMTP submission.
SMTP Port 2525
SMTP port 2525 is a tricky port that is created by typing 25 twice as port 25 is the first port number of the SMTP. Port 2525 is not assigned officially for the SMTP usage because it is not recognized by authorities IETF or IANA. But the similarity of the numbers made port 2525 popular and most of the ISPs, cloud service providers and email servers support and allow access of port 2525 SMTP service. Especially Port 2525 will be a good alternative can if port 587 is blocked.
Check If SMTP Port Is Blocked or Accessible
As there are 4 popular SMTP ports deciding which of them are accessable for SMTP may be required in some cases. There are different ways to check SMTP ports like using a tool for simple port check or using a web service or application.
We can use
telnet in order to check the remote SMTP ports like 25, 587, 465, 2525 or another port. telnet is a simple command line tool which is used for remote shell connection and management but also used for port check for different protocols. In this example we will check the Gmail SMTP ports where the SMTP service is provided with the
smtp.google.com domain name.
$ telnet smtp.gmail.com 25 $ telnet smtp.gmail.com 587 $ telnet smtp.gmail.com 465 $ telnet smtp.gmail.com 2525
From the example and screen shot we can see that when the remote SMTP port is available or open we will get a message like
Connected to smtp.gmail.com and get some banner or welcome message which provides information about the SMTP server and service like
220 smtp.gmail.com ESMTP f131sm5873330wme.40 - gsmtp .If the SMTP port or service is not avaiable we will get a message like
Unable to connect to remote host: Network is unreachable . For this example Gmail provides SMTP ports 25,587, 465 via smpt.gmail.com.
SMTP Port Communication Example
SMTP is mainly a text-based protocol where management is done via text or ASCII command. When connected an SMTP port commands like EHLO, STARTTLS, SIZE, etc can be used.
EHLO command is the reverse form of the helo and used to get command information about the SMTP server.
SIZE command is used to set the email message or data size we want to send.
STARTTLS command is used to start TLS encrypted secure communication. 250 – STARTTLS means the SMTP port can accept TLS connections.
$ telnet smtp.pepipost.com 587 Trying 18.104.22.168... Connected to smtp.pepipost.com. Escape character is '^]'. 220 ESMTP SMTPNY-LB1 Ready 500 5.5.2 Error: bad syntax ehlo pepipost.com 250-smtpny-lb1.pepipost.com 250-PIPELINING 250-SIZE 50000000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN STARTTLS 220 2.0.0 Ready to start TLS
SMTP Port Security and SSL/TLS Connection
SMTP uses the SSL/TLS certificates in order to secure and encrypt SMTP connection.
openssl command provides the s_client command in order to test and connect remote SMTP service with an SSL/TLS connection. We will also provide the remove SMTP server domain name and port number like below by using the
-connect option. SSL/TLS encrypted SMTP connection is named as SMTPS.
$ openssl s_client -starttls smtp -crlf -connect smtp.mailgun.org:587
Popular Mail Service Providers SMTP Port Numbers
Today email and SMTP are core and important part of the IT. There are a lot of different email service and server providers which provides SMTP service via SMTP ports. Below you can find popular SMTP service providers SMTP port numbers.
|SMTP Provider||SMTP Server Address||SMTP Ports|
|Google or Gmail||smtp.gmail.com||465, 587|
|Yahoo Mail Plus||plus.smtp.mail.yahoo.com||465|
|Yahoo Austraila/New Zelland||smtp.mail.yahoo.com.au||465|