Written by Christian Ahmer | 11/20/2023

SMTP

SMTP stands for Simple Mail Transfer Protocol. It is the Internet standard protocol used by email servers to send, receive, and relay outgoing emails between senders and receivers. SMTP is used with a mail transfer agent (known as an SMTP Relay) to send your emails to the right email server.

Here's a basic overview of how SMTP works and its role in the email sending process:

  1. Sending Emails: When you send an email, your email client (such as Outlook or Gmail) communicates with the SMTP server using the SMTP protocol. You provide the recipient's email address, subject, message body, and any attachments.

  2. SMTP Server: The SMTP server takes the recipient's email address and finds the domain part (the section after the '@'). It then uses a DNS server to translate the domain into an IP address, which corresponds to the recipient's email server.

  3. Relaying: If the SMTP server is not the final destination (which is usually the case), it acts as a relay. It forwards the email to another SMTP server closer to the recipient's email server.

  4. SMTP Commands and Responses: SMTP uses a set of commands that the sending email client executes to relay the email data to the server. The server then responds to these commands in sequence to continue the process. These commands include HELO (or EHLO for Extended SMTP), MAIL FROM, RCPT TO, and DATA.

  5. Port 25: SMTP traditionally operates over TCP port 25. However, for secure communication, SMTPS (which stands for SMTP Secure) may operate over port 465 or 587 and uses encryption protocols such as TLS (Transport Layer Security).

  6. MIME: Although SMTP is purely a text-based protocol, it can send binary files (like images or documents) using MIME (Multipurpose Internet Mail Extensions), which encodes binary data to text.

  7. Delivery to Mailbox: Once the recipient's SMTP server has received the email, it places the email into the recipient's mailbox.

  8. Retrieval by Recipient: Finally, the recipient uses an email client with POP3 (Post Office Protocol) or IMAP (Internet Message Access Protocol) to retrieve and read the message from the mailbox.

SMTP's simplicity and ability to push messages to a sender's outgoing mail server make it the backbone of email communication on the Internet. However, SMTP itself doesn't include mechanisms for authentication or encryption, making it susceptible to spam and phishing attacks. Therefore, additional technologies like SPF (Sender Policy Framework), DKIM (DomainKeys Identified Mail), and DMARC (Domain-based Message Authentication, Reporting, and Conformance) are used in conjunction with SMTP to improve security and verify that emails are not tampered with and are sent from authenticated mail servers.