---
aliases: ["Simple Mail Transfer Protocol"]
obj: concept
wiki: https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
rfc: https://datatracker.ietf.org/doc/html/rfc5321
---

# Simple Mail Transfer Protocol
Simple Mail Transfer Protocol (SMTP) is a protocol used for the transmission of electronic mail ([email](eMail.md)) over a computer network. SMTP is a text-based protocol that facilitates the sending and receiving of [emails](eMail.md) between servers and is a fundamental component of [email](eMail.md) communication on the internet.

## Key Concepts
### 1. **Message Transfer:**
- SMTP is primarily responsible for the transfer of [email](eMail.md) messages between a sender's [email](eMail.md) client (Mail User Agent - MUA) and a recipient's [email](eMail.md) server (Mail Submission Agent - MSA) and between [email](eMail.md) servers (Mail Transfer Agent - MTA).
### 2. **Client-Server Interaction:**
- SMTP operates on a client-server model, where an [email](eMail.md) client sends messages to an [email](eMail.md) server for delivery. Servers communicate with each other to relay messages.
### 3. **Port Number:**
- SMTP uses port `25` for unencrypted communication. Port `587` is commonly used for secure communication with Transport Layer Security (TLS).
### 4. **Commands and Responses:**
- SMTP communication involves a series of commands and responses between the client and server. Common commands include `HELO` (client identification), `MAIL FROM` (specify sender address), `RCPT TO` (specify recipient address), `DATA` (begin message data input), and `QUIT` (terminate the session).
### 5. **Relaying:**
- SMTP allows for the relaying of messages between different [email](eMail.md) servers, facilitating the delivery of [emails](eMail.md) across different domains.

## SMTP Operation
### 1. **Handshake:**
- The SMTP session begins with a handshake, where the client identifies itself to the server using the `HELO` or `EHLO` (extended hello) command.
### 2. **Sender and Recipient Specification:**
- The client specifies the sender's address using the `MAIL FROM` command and the recipient's address using the `RCPT TO` command.
### 3. **Message Transmission:**
- The actual message is transmitted using the `DATA` command, allowing the client to send the message body and headers.
### 4. **Session Termination:**
- The session concludes with the `QUIT` command, indicating the end of the SMTP communication.