Have you ever wondered how your email gets to its recipient?
When sending and receiving emails, most computers use a protocol called SMTP. This stands for Simple Mail Transfer Protocol. Without it, emails are unable to transfer from your email client to someone else’s.
It was developed in the early 1980s by the Internet Engineering Task Force (IETF). It is also known as RFC 821 and RFC 2821.
It is part of the application layer of the TCP/IP protocol. The protocol uses a procedure called “store and forward”. It moves an email from one computer’s Mail Transfer Agent (MTA) to another MTA. SMTP describes how emails get to the correct destination using “store and forward” at each part of its journey.
The sent messages can be collected using an email client with either Post Office Protocol 3 (POP3) or Internet Message Access Protocol (IMAP). SMTP usually sends messages from the mail client to the mail server, thus the need to specify a POP or IMAP server when an email client is configured.
SMTP is integrated into email clients and includes four vital parts: a local user or client-end utility called the mail user agent (MUA); a server called the mail submission agent (MSA); a mail transfer agent (MTA); and a mail delivery agent (MDA).
The SMTP server
An SMTP server is just a computer running SMTP. Once messages are picked up they are sent to this server for passing onto recipients.
Six steps to (email) heaven
An email is sent from sender to recipient using six steps.
1) The email is submitted by an MUA to a mail server’s MSA.
2) This email is transferred to the server’s MTA via port 25 (the MTA and MSA are typically hosted on the same SMTP server).
3) The MTA confirms the MX record of the recipient domain and transfers the message to another MTA (this can happen many times until the message is received by the destination server).
4) The email is given over to the MDA, which saves the message in the correct format for retrieval by the receiving MUA.
5) The receiving MUA requests the message from the MDA via POP3 or IMAP.
6) Lastly, the email is delivered to the receiving MUA‘s inbox.
Using MIME to send attachments
SMTP is a very reliable protocol, but it is constrained to sending text only. This would make email very limited as we wouldn’t be able to send any attachments. This is where MIME comes in.
MIME stands for Multipurpose Internet Mail Extensions. This is an extension to SMTP that allows users to send different kinds of files over the internet, such as audio, video, images, application programs, etc. It also allows for non-Latin characters and emails that contain multiple parts (such as an email with a plain text element and an HTML element).
SMTP Authentication
Another extension to SMTP is SMTP Authentication. This enables email clients to authenticate when connecting to an SMTP server using a username and a password. This prevents unauthorised users from sending email through an SMTP server.
Credits: https://www.itpro.co.uk/mail-servers/31694/what-is-smtp