What is SMTP, and what are the default ports for it?
Table of Contents
Emails play an essential role in our personal and business communication, ensuring smooth information flow. Despite the rise of social media, messengers, and chat apps, e-mails remain predominant in digital communication.
Sending emails is possible thanks to the Simple Mail Transfer Protocol which defines the process of email distribution.
This tutorial will dive into what SMTP means, how it works, and the default SMTP ports you can use.
The email message is relayed to another Mail Transfer Agent when a recipient’s inbox is not hosted locally. Each time an MTA receives a message, it adds a “Received” header as a trace in the email header. This way, a hop sequence is built to trace the MTAs handling the message.
SMTP has an asymmetrical mechanism that allows many clients to interact with one server, using the TCP/IP suite.
Email protocols are sets of rules designed to organize the exchange of information between email clients (MUA) and email servers. The Simple Mail Transfer Protocol is dedicated to sending mail, while other protocols (POP3/IMAP) are used to receive mail.
What is an SMTP server?
An SMTP server is a service application that allows a server to submit, forward, and receive outgoing messages. Note that the SMTP server is not a full-blown server machine but software that processes data to send to another server. This service is constantly functioning, waiting to send a new email.
Typically, a server administrator assigns a name to the SMTP server following the format smtp.servername.com. The outgoing mail server uses the Simple Mail Transfer Protocol to push emails through ports 2525 and 25 (for plaintext) or ports 465 and 587 (for encrypted messages).
If you are using SiteGround’s email services, you can find your SMTP server address in the respective Site Tools > Email > Accounts. You can find the Mail Configuration section next to each email address under the Actions menu. In the Manual settings section, you will see SiteGround’s SMTP server address for your domain name.
![Mail configuration SiteTools](png/mail-configuration-site-tools-708x311.png)
How does it work?
When you send an email, your mail client submits it to an email server via port 465 or 587, using SMTP. Upon the initial contact, the email client establishes a two-way transmission channel to the mail server. Both are using SMTP commands and replies to communicate. The first interaction between the two is called a “handshake.”
The handshake between these entities identifies the sender, i.e., hostname. Next comes the specification of the original sender or the email address the message is sent from. Afterward, the client and the server exchange the information for the destination address and the actual message’s content. When all this data is communicated, the SMTP mechanism closes the connection.
![Illustration on How SMTP works](png/smtp-process-708x374.png)
An email message may be sent directly to the ultimate destination by the mail server in a single connection. Alternatively, the email server may “relay” the message to other intermediate mail servers in a series of hops. When this same message is intended for multiple recipients, SMTP transmits only one copy of it to all recipients to the same destination.
Additionally, an email client may connect to the SMTP server to authenticate the email sender. SMTP authentication is an extension to the protocol, which allows only verified users to establish a connection. When the identity of the sender is confirmed, the email server will proceed with the email transaction.
According to the Internet Engineering Task Force, if the transaction fails, the SMTP server must provide the response error to the email client.
What is an SMTP port?
An SMTP port is a communication endpoint that defines the routing of email transactions through the network, from server to server.
Internet services require two requisites to convey communications properly – a domain name or an IP address and a port number. An internet address is necessary to identify a machine in the network, while the port is needed to specify the service to use.
That being said, ports have a crucial role in an email exchange as each has a distinct objective. Each SMTP port number is associated with a particular internet protocol but provides a different type of service.
Internet ports are assigned by the IANA (Internet Assigned Numbers Authority) organization.
What ports does SMTP use?
Connecting to an SMTP server requires you to provide the server’s address and a particular port number. In general, there are four ports reserved for the Simple Mail Transfer Protocol, and they are 25, 2525, 465, and 587.
In this section, we will describe all four ports and explain the purpose of each.
- Port 25
The SMTP port 25 was first introduced in 1982 in RFC 821 as the default for SMTP. In a nutshell, port 25 was intended for relaying messages between email servers.
Despite that, many people use it for SMTP submission from email clients to mail servers. Unfortunately, port 25 is used for aggressively spreading spam and malware. This port is not secured by default, and messages pushed through it are in plain text.
Therefore, many Internet Service Providers block port 25 for security reasons. In such a case, you will see an error like “Could not connect to SMTP host localhost port 25”.
Even so, 25 can work with TLS (Transport Layer Security) if an MTA server supports it. If it doesn’t, the receiving server may read the email in plain text or abort the delivery.
Luckily, three more ports are available to establish an SMTP connection.
- Port 2525
Port 2525 is an alternative port, although the IETF or IANA do not recognize it. Still, this port doesn’t fall into the reserved range of ports and is free to use as an SMTP port. Port 2525 is a secure SMTP port that you can use with TLS encryption. Therefore, many Email Service Providers support using 2525 as a backup port.
- Port 465
In 1997, a proposition for a new standard to send messages with encryption was published. The body of IANA then assigned 465 as the SMTP port (SMTP over Secure Sockets Layer). This SMTP SSL port encrypts the entire content of a message right from the start of the connection between mail servers. Sadly, many servers at this point were not compatible with this type of encryption.
Also, the IETF never recognized it as an SMTP secure port. Later that same year, the Start TLS (STARTTLS command) on port 587 was introduced by IETF. Thus, port 465 became obsolete, although many server administrators still prefer it as it requires an implicit TLS/SSL connection.
Implicit TLS/SSL means that the client MTA requires a secure connection to the SMTP server to commence a transaction. If the connection is not encrypted, the message will be blocked from sending, and the operation will be aborted. In consequence, the overall email deliverability may be affected.
- Port 587
As we mentioned above, SMTP port 587 was registered by the IETF as the secured port for message submission. The security of this endpoint is covered by explicit TLS protocol.
This protocol allows a message to be transmitted in encryption if the mail server supports it. If the mail server does not support TLS, the message will be sent in plain text.
Start TLS works with both TLS and SSL, although TLS is preferred over SSL as a more secure one. Furthermore, you can also use this protocol for encrypted communication via port 25.
Which is the recommended SMTP port?
Depending on the server configuration, usually, port 587 is recommended as the official SMTP TLS port. Still, the implicit TLS/SSL connection on 465 is widely used since it requires encryption for a transaction to start.
Summary
The Simple Mail Transfer Protocol is an email exchange mechanism dedicated to email sending, submission, and relaying. We delved into the meaning of SMTP & SMTP servers, how it functions, what are the default ports and the recommended SMTP ports you can use. Armed with this knowledge, you can now safely navigate the world of email running on SMTP.