What is SMTP?
We all have heard the term IP, short for Internet Protocol. We need an IP to access the internet but the thing that might have slipped through is the SMTP (Simple Mail Transfer Protocol) which takes care of all the emails. SMTP is the most widely used email protocol and is a part of the TCP/IP protocol which is used to send and receive emails.
So, how does it work?
As part of being a protocol in the application layer, the SMTP server is always waiting for a request. When a mail is sent through an email client (Gmail, Yahoo, Outlook), a TCP connection is made which results in the start of the SMTP process (typically port 25). As soon as the connection is successfully set up, the mail will be sent to the relevant destination. In simpler terms, the mail you want to send is taken from your mail client and sent to the destination.
SMTP works hand in hand with MTA (Mail Transfer Agent). MTA is present in all computers and the functionality of the SMTP is to coordinate between the MTAs so that the email will be successfully sent from point A to point B.
SMTP uses a set of codes which makes it easier to communicate between the mail servers. When an email is sent out, it transforms into plain text separated by codes which make the email server understand the purpose of each section. Each message travels through many servers (sometimes MTAs) before getting to the destination and the special codes enable the process to happen smoothly. Just like traditional mail being handed from one hand to the other, SMTP does the same process but on a digital level.
These are some of the commands being used:
- HELO - starts the conversation by identifying the sender server and its domain name.
- VRFY – Server is asked to verify if a particular email address or username actually exist.
- EXPN – Asks for a confirmation about the identification of a mailing list
- RCPT TO – Identifies recipient of the email. If there are more than one, the command is repeated for each address.
One interesting thing you should know is that SMTP is capable of sending only text. But how do the images, fonts, attachments get sent? Well, Multipurpose Internet Mail Extensions were created which encodes all non-text content into plain text. Now all is text, and off they go through the SMTP.