Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

SMTP Protocol

SMTP Protocol

SMTP (Simple Mail Transfer Protocol) is a network protocol used to send email.

SMTP is one of the core protocols for email transmission on the Internet, responsible for delivering mail from the sender to the recipient's mail server.


How SMTP Works

SMTP uses a client-server model and transmits mail through plaintext or encrypted communication channels. Its core functions are sending and delivering mail.

1. SMTP Connection Establishment

2. Sending Mail

After the connection is established, the client can send mail. The following is a typical mail sending process:

3. Connection Closure

After the mail is sent, the client can close the connection:

  • The client sends the QUIT command to request closing the connection.
  • The server returns status code 221, indicating the connection has been closed.

  • Key Features of SMTP

    1. Text-Based Protocol:

    2. SMTP is a text-based protocol; commands and responses are readable strings.
    3. - SMTP is a text-based protocol; commands and responses are readable strings.
      1. Reliability:

      2. Ensures reliable mail transmission through status codes and retry mechanisms.
      3. - Ensures reliable mail transmission through status codes and retry mechanisms.
        1. Extensibility:

        2. Supports extended commands (such as EHLO) and extended features (such as authentication and encryption).
        3. - Supports extended commands (such as EHLO) and extended features (such as authentication and encryption).
          1. Safety:

          2. Supports the STARTTLS command to upgrade a plaintext connection to an encrypted one.
          3. - Supports the STARTTLS command to upgrade a plaintext connection to an encrypted one.

            Applications of SMTP

            SMTP is widely used in the following scenarios:


            Security of SMTP

            SMTP itself is insecure because it transmits data in plaintext during transmission. To improve security, the following extensions can be used:


            Alternatives to SMTP

            In some scenarios, the following alternatives can be used:


            In summary, SMTP is a protocol used to send email, delivering mail from the sender to the recipient's mail server through a client-server model. It supports extended features and security improvements, but attention must be paid to its plaintext transmission issue. If you are interested in a specific feature or application scenario of SMTP, feel free to explore further!