SMTP

Simple Mail Transfer Protocol operates in the Application Layer and uses TCP ports 25 and 465/587 for encrypted communication. It is the primary protocol used for sending and relaying email messages across the Internet, by transferring messages between mail servers and sending client applications. SMTP does not handle email retrieval, so it works alongside IMAP or POP3 for receiving emails.

SMTP follows a client-server model in the following way:

  • SMTP Client: The system, such as an email application or mail transfer agent, sends emails to an SMTP server

  • SMTP Server: The mail server processes, routes, and delivers email messages to the recipient’s mail server

To facilitate email transfer, SMTP uses a series of commands and responses between mail servers. Some of them are:

  • HELO/EHLO: Identifies the sending mail server to the recipient server

  • MAIL FROM: Specifies the sender’s email address

  • STARTTLS: Switch plaintext connection to encrypted connection

  • RCPT TO: Defines the recipient’s email address

  • DATA: Transfers the content of the email

  • RSET: Abort initiated transmission, but keep the connection

  • VRFY: Check if a mailbox is available for message transfer

  • QUIT: Ends the session

SMTP servers also use authentication and encryption mechanisms, such as SSL or TLS, to secure email communication.

Interaction with the protocol

  • Connect to an SMTP server using the Telnet protocol


  • Check for existing users


  • Set the sender and receiver


  • Send data


  • Close connection

Last updated