A KNOW-HOW GUIDE - SMTP
There is a guide for using everything. A certain set of rules. And so does THE INTERNET. Simple Mail Transfer Protocol (SMTP) is an Internet Norm for transferring Electonic Mail (E-mail). It was first conceptualized by Request For Comments (RFC). Request for Comments (RFC) is a form of publication from the Internet Engineering Task Force (IETF) and the Internet Society (ISOC), the primary technical development and standards-setting bodies for the Internet.
In laymen language, SMTP is simple decorum that is followed by emails for transmission through out the internet. In more plain terms, SMTP can be considered as a post office where sender deposits their email and it delivers to the receiver’s local post office i.e. another SMTP server.
It was first defined by RFC 821 in 1982, but the latest update was done in 2008 by RFC 5321. The latest SMTP was edited with Extended SMTP also known as Enhanced SMTP (ESMTP). It is a definition of protocol extensions to the Simple Mail Transfer Protocol standard. The Extension format was defined in IETF publication RFC 1869 in November 1995 which established a basic structure for all existing and future extensions.
Although email servers and other mail transfer agents use SMTP for sending and receiving emails, consumer mail applications typically use SMTP only for sending messages to a mail server for Relaying. And to retrieve messages, consumer mail applications usually use either POP3 or IMAP.
SMTP is a delivery protocol only. Other protocols, such as the Post Office Protocol (POP) and the Internet Message Access Protocol (IMAP) are specifically designed to retrieve messages by individual users and managing mail boxes.
A Port is an end point of communication in an operating system. It identifies a particular process or a type of network services. A port is always associated with an IP address and the protocol type of the communication, and thus completes the destination or origination network address of a communication session.
A port is identified for each address and protocol by a 16-bit number, commonly known as the port number. For example, an address may be “protocol: TCP, IP address: 126.96.36.199, port number: 80”, which may be written 188.8.131.52:80 when the protocol is known from context. Specific port numbers are often used to identify specific services.
And there are four major port numbers that identify SMTP process. They are 25, 465, 587 and 2525.
Port Number 25
- From 1982 till date, Port 25 is used as the default port to communicate email across the Internet using the SMTP.
- Even after more than 3 decades, Port 25 is used as the essential means for transmitting between two email servers.
- But the direction is changing now. Most SMTP clients are avoiding the usage of Port 25 because of many ISPs and hosting providers block or restrict SMTP connections on port 25 in order to prevent spamming.
Port Number 465
- After Port 25, In 1997, the IANA registered 465 for SMTPS. Where SMTPS stands for an SMTP connection which is secured by TLS which can be made using STARTTLS.
- It was initially planned for the SMTPS encryption and authentication “wrapper” over SMTP. But the end of 1998, this was revoked in favor of STARTTLS over SMTP (RFC 3207). With STARTTLS, this port can be used with or without TLS.
- Now SMTPS and its use on Port 465 remain nothing more than a historical footnote.
Port Number 587
- After the major faliure of Port 465, In December 1998, R. Gellens and J. Klensin submitted RFC 2476.
- The above mentioned RFC defined that Port 587 is reserved for email message submission. It is being used as a default mail submission port.
- When a mail client or server wants to submit email and want it get delivered properly without any interruption, it should use this port.
- This port when coupled with TLS encryption, ensure that the mail will be submitted securely and following the guidelines of IETF.
Port Number 2525
- Port 2525 is used when all the other ports are blocked or fail to serve their purpose.
- Port 2525 is unofficially used as a backup to port 25 SMTP (Simple Mail Transfer Protocol).
- This is useful as a dedicated port for VPN clients or for those who cannot directly send mail to a mail server outside of their ISP’s network because of an ISP blocking port 25.
- Almost every ESP supports the use of Port 2525, even though this is not an official SMTP port and not endorsed by neither the IETF nor IANA.
Secure Sockets Layer (SSL), is a cryptographic protocol that provides communications security over a computer network. SSL, now, is known as Transport Layer Security. The Transport Layer Security protocol aims primarily to provide privacy and data integrity between two communicating computer applications.
The TLS protocol comprises two layers: the TLS record protocol and the TLS handshake protocol.
TLS handshake protocol
- When the connection starts, the record encapsulates a “control” protocol—the handshake messaging protocol.
- This protocol is used to exchange all the information required by both sides for the exchange of the actual application data by TLS. It defines the format of messages and the order of their exchange.
- When establishing a secure session, the Handshake Protocol manages the following: Cipher suite negotiation, Authentication of the server and optionally, the client and Session key information exchange.
- These may vary according to the demands of the client and server—i.e., there are several possible procedures to set up the connection.
TLS record protocol
- The Transport Layer Security (TLS) Record protocol secures application data using the keys created during the Handshake.
- The Record Protocol is responsible for securing application data and verifying its integrity and origin.
- It Divides outgoing messages into manageable blocks, and reassembling incoming messages.
- It Compress outgoing blocks and decompress incoming blocks (optional).
- It Applys a Message Authentication Code (MAC) to outgoing messages, and verifying incoming messages using the MAC. It also Encrypt outgoing messages and decrypt incoming messages.
TLS is a proposed Internet Engineering Task Force (IETF) standard, first defined in 1999 and updated in RFC 5246 (August 2008) and RFC 6176 (March 2011). It builds on the earlier SSL specifications (1994, 1995, 1996) developed by Netscape Communications for adding the HTTPS protocol to their Navigator web browser.