Simple Mail Transfer Protocol (SMTP) is used for sending and routing email messages over the internet. SMTP is text line based, which relies on plain text SMTP Commands and responses for communication between the email sender and the receiver. These commands and responses are human-readable and straightforward.

Email client development

SMTP is used in the development of email clients, which are software applications that allow users to send, receive, and manage emails.

Mail server

When an email client wants to send a email to recipient, it needs to determine the mail server responsible for handling email for the recipient’s domain. This information is obtained by querying the DNS MX records for the recipient’s domain. MX records specifies the mail server that should receive email for a given domain.

SMTP interaction process

The SMTP interaction follows a specific process when an email client communicates with an email server. The process involves the SMTP Commands.

  1. DNS MX record lookup Before sending an email, the email client determines the recipient’s mail server by performing a DNS MX record lookup for the recipient’s domain. MX records specifies the mail servers responsible for receiving email for a domain.
  2. Connection establishment The email client establishes a TCP connection to the destination mail server on the SMTP port which is typically port 25.
  3. Exchange email message The email client initiates communication by sending an initial SMTP command to the destination mail server. The server responds with an initial status message. The client and server then engage in a series of back-and-forth exchanges, following the SMTP protocol.
    1. Sender verification (HELO)
    2. REcipient verification (RCPT TO)
    3. Data transfer (DATA)
    4. Termination (.) More details are discussed in SMTP Commands.
  4. Message delivery or relaying The server processes the received message, which may include storing it in the recipient’s mailbox, forwarding it to another server or performing other actions based on its configuration.
  5. Closing the SMTP connection After successfully sending the email message, the client or server can issue an SMTP “QUIT” command to close the SMTP session.

Back to parent node: Application Layer

Computer_networksINFO1112IP_modelApplication_layerSimple_Mail_Transfer_Protocol_SMTPSMTP_commandDNS_recordTCP_port