# What is SMTP? Definition and basics

If email is the electronic mail, then SMTP is the mail carrier. SMTP remains the most important protocol for sending emails to this day, but in practice, it is almost always used in its extended form, ESMTP — with authentication and encryption as standard.

### Key Takeaways

- SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending and forwarding emails.
- To send from an email client today, use port 587 (STARTTLS) or port 465 (SSL); port 25 is now only used for transport between servers.
- On its way to the destination, an email passes through the outgoing mail server, the DNS lookup of the MX record, and one or more MTAs; the recipient then retrieves it via IMAP or POP3.
- In an SMTP session, the client sends commands such as EHLO, MAIL FROM, RCPT TO, and DATA, and the server responds with three-digit status codes.
- The original SMTP lacked authentication; today, SMTP AUTH, TLS, SPF, DKIM, and DMARC are meant to prevent misuse.
- Nearly all modern mail servers use ESMTP, the extension of SMTP introduced in 1995.

## What is the SMTP protocol?

SMTP stands for ‘Simple Mail Transfer Protocol’. It is a connection-oriented, text-based network protocol from the internet protocol family, and it is situated on the seventh layer of the OSI model, the application layer. Like any other network protocol, it contains rules for proper communication between computers in a network. SMTP is specifically responsible for the **submission and forwarding of emails** from a sender to a recipient.

Since its release in 1982 on the Arpanet, SMTP has become the **standard protocol for sending emails**. For end users, configuration is almost automatic today: Modern clients like Outlook, Thunderbird, or webmail applications provide **SMTP (or ESMTP) with STARTTLS and port 587** as default settings.

The following overview shows the **SMTP server addresses** and **SMTP ports** for some of the most popular email providers:

<table>
  <thead>
    <tr>
      <th>Email provider</th>
      <th>SMTP server address</th>
      <th>SMTP port</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Gmail</td>
      <td>smtp.gmail.com</td>
      <td>587 (TLS/STARTTLS), 465 (SSL)</td>
    </tr>
    <tr>
      <td>Microsoft 365</td>
      <td>smtp.office365.com</td>
      <td>587 (STARTTLS)</td>
    </tr>
    <tr>
      <td>Outlook.com</td>
      <td>smtp-mail.outlook.com</td>
      <td>587 (STARTTLS)</td>
    </tr>
    <tr>
      <td>Yahoo Mail</td>
      <td>smtp.mail.yahoo.com</td>
      <td>465 (SSL), 587 (TLS/STARTTLS)</td>
    </tr>
    <tr>
      <td>iCloud Mail</td>
      <td>smtp.mail.me.com</td>
      <td>587 (TLS/STARTTLS), 465 (SSL)</td>
    </tr>
  </tbody>
</table>

Note Port 25 (traditional SMTP) is usually blocked for end-users and is only used for mail transport between servers. To send through a user account, always use 587 or 465.

## How does the SMTP procedure work?

Understanding the SMTP procedure means understanding email. Basically, it works as follows:

### Step 1: Sending the email to the SMTP server (submission)

- The **SMTP client**, or the sender, uploads the email to the SMTP server, which is the email server (outgoing mail server) of the respective provider.
- This occurs through a webmail application in the browser or an email program (‘Mail User Agent’ or MUA) like Outlook or Mozilla Thunderbird.
- Nowadays, this transfer typically occurs over port 587 with STARTTLS encryption and SMTP AUTH (username + password).

### Step 2: Resolving the address via DNS

- The sender’s SMTP server contacts the DNS server and determines the **IP address of the destination SMTP server** (MX record of the recipient’s domain).

### Step 3: Forwarding through Mail Transfer Agents (MTAs)

- The email is forwarded through one or more **Mail Transfer Agents (MTA)**.
- Each MTA operates according to SMTP or ESMTP rules.
- In transit, the connection is typically secured by [TLS](https://www.ionos.com/en-ie/digitalguide/server/security/tls-transport-layer-security/) to prevent tampering and eavesdropping.

### Step 4: Acceptance at the destination SMTP server

- The destination server (recipient mail server) checks if the mailbox exists.
- Many mail servers additionally check SPF, DKIM, and [DMARC](https://www.ionos.com/en-ie/digitalguide/e-mail/e-mail-security/dmarc-domain-based-message-authentication-reporting-and-conformance/) records to prevent spoofing and spam.
- The email is temporarily stored in the message storage.

### Step 5: Retrieval by the recipient

- The recipient retrieves the email via IMAP or POP3.
- Today, IMAP is the standard because it allows synchronisation between devices.

[![Image: Diagram of SMTP Process](https://www.ionos.com/en-ie/digitalguide/fileadmin/_processed_/5/f/csm_SMTP-process_c95d81ab9c.webp "Diagram of SMTP Process")](https://www.ionos.com/en-ie/digitalguide/fileadmin/DigitalGuide/Schaubilder/SMTP-process.jpg) The forwarding of an email from the SMTP client through the server to the message storage of the destination SMTP server is governed by the SMTP protocol. Only then do other network protocols come into play. ## How does an SMTP session work?

The **interaction between the SMTP client and the SMTP server** mentioned in the first step of the SMTP process constitutes the actual SMTP session. Each session consists of a sequence of SMTP commands from the client and responses in the form of status codes from the server.

### Overview of SMTP commands

According to the current SMTP specifications (RFC 5321), every implementation of the network protocol must support the following **commands**, consisting of **7-bit ASCII characters**; only `EXPN` is optional:

<table>
  <thead>
    <tr>
      <th>SMTP command</th>
      <th>Meaning</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>HELO</td>
      <td>‘Hello’. – The client identifies itself with the computer name and initiates the session.</td>
    </tr>
    <tr>
      <td>EHLO</td>
      <td>Extended ‘Hello’. Requests the server’s capabilities (ESMTP), such as STARTTLS or AUTH.</td>
    </tr>
    <tr>
      <td>MAIL FROM</td>
      <td>Client specifies the sender of the email.</td>
    </tr>
    <tr>
      <td>RCPT TO</td>
      <td>‘Recipient’ – The client specifies the recipient address of the email.</td>
    </tr>
    <tr>
      <td>DATA</td>
      <td>Start of transfer (Header + Body).</td>
    </tr>
    <tr>
      <td>RSET</td>
      <td>Abort transfer, connection remains open.</td>
    </tr>
    <tr>
      <td>VRFY/EXPN</td>
      <td>‘Verify’/‘Expand’ – Check if a mailbox exists / Distribution list is expanded.</td>
    </tr>
    <tr>
      <td>NOOP</td>
      <td>‘Keep alive’: Prevents a timeout.</td>
    </tr>
    <tr>
      <td>QUIT</td>
      <td>Ends the session.</td>
    </tr>
  </tbody>
</table>

### Overview of server status codes

The server responds to each of these SMTP commands from the client with **a three-digit status code and a plain text message**.

Status codes indicating that the server has **successfully executed the command**:

<table>
  <thead>
    <tr>
      <th>Status code</th>
      <th>Plain text message</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>200</td>
      <td>(Non-standard success response)</td>
    </tr>
    <tr>
      <td>211</td>
      <td>System status or system help request</td>
    </tr>
    <tr>
      <td>214</td>
      <td>Request for help with executing a command</td>
    </tr>
    <tr>
      <td>220</td>
      <td>Server is ready for the SMTP session</td>
    </tr>
    <tr>
      <td>221</td>
      <td>Server closing the connection</td>
    </tr>
    <tr>
      <td>250</td>
      <td>OK – Command executed</td>
    </tr>
    <tr>
      <td>251</td>
      <td>OK – No local user present, mail will be forwarded</td>
    </tr>
    <tr>
      <td>252</td>
      <td>OK – Recipient address cannot be verified, transmission will still be attempted</td>
    </tr>
    <tr>
      <td>253</td>
      <td>OK – Messages are set to ‘Pending’</td>
    </tr>
  </tbody>
</table>

Status codes indicating that the server understood the command but requires **further information** for processing:

<table>
  <thead>
    <tr>
      <th>Status code</th>
      <th>Plain text message</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>354</td>
      <td>Server starts mail reception</td>
    </tr>
  </tbody>
</table>

Status codes indicating that the server has detected a **temporary error**, but the command might still be processed:

<table>
  <thead>
    <tr>
      <th>Status code</th>
      <th>Plain text message</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>421</td>
      <td>Server not available, connection will be terminated</td>
    </tr>
    <tr>
      <td>450</td>
      <td>Command not executed, mailbox not available</td>
    </tr>
    <tr>
      <td>451</td>
      <td>Command execution aborted due to local error</td>
    </tr>
    <tr>
      <td>452</td>
      <td>Command not executed due to insufficient system storage</td>
    </tr>
  </tbody>
</table>

Status codes indicating that the server has detected a **fatal error** and the command cannot be processed:

<table>
  <thead>
    <tr>
      <th>Status code</th>
      <th>Plain text message</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>500</td>
      <td>Syntax error, command unrecognised</td>
    </tr>
    <tr>
      <td>501</td>
      <td>Syntax error in parameters or arguments</td>
    </tr>
    <tr>
      <td>502</td>
      <td>Command does not exist</td>
    </tr>
    <tr>
      <td>503</td>
      <td>Invalid command sequence</td>
    </tr>
    <tr>
      <td>504</td>
      <td>Command parameter does not exist</td>
    </tr>
    <tr>
      <td>521</td>
      <td>Server is not accepting mails</td>
    </tr>
    <tr>
      <td>530</td>
      <td>Access denied</td>
    </tr>
    <tr>
      <td>550</td>
      <td>Command not executed, mailbox not found</td>
    </tr>
    <tr>
      <td>551</td>
      <td>No local user, try forwarding</td>
    </tr>
    <tr>
      <td>552</td>
      <td>Command execution aborted, error in memory allocation</td>
    </tr>
    <tr>
      <td>553</td>
      <td>Command not executed, invalid mailbox name</td>
    </tr>
    <tr>
      <td>554</td>
      <td>Transmission failed</td>
    </tr>
  </tbody>
</table>

### SMTP example session

An SMTP session between client and server can proceed as follows, for example:

<table>
  <thead>
    <tr>
      <th>Role</th>
      <th>SMTP commands and status codes</th>
      <th>Explanation</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Server</td>
      <td>220 smtp.example.com ESMTP Postfix</td>
      <td>After the connection is established, the SMTP server identifies itself.</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>HELO relay.example.com</td>
      <td>The SMTP client identifies itself with its computer name.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>250 smtp.example.com, Hello</td>
      <td>The server confirms the login.</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>MAIL FROM:&lt;john@company.com&gt;</td>
      <td>The client specifies the sender’s address of the MUA.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>250 OK</td>
      <td>The server confirms.</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>RCPT TO:&lt;boss@company.com&gt;</td>
      <td>The client specifies the recipient’s address.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>250 OK</td>
      <td>The server confirms.</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>DATA</td>
      <td>The client initiates the transmission of the email.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;</td>
      <td>The server starts receiving and indicates that the email text should be closed with a full stop (‘.’).</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>From: "John Smith" &lt;john@company.com&gt;  
To: Boss Company &lt;boss@company.com&gt;  
Date: Friday, 19 September 2025 10:03:42  
Subject: Sick leave  
  
Hello \[Boss’s name\],  
I’m feeling unwell today and won’t be able to come in. I’ll send my doctor’s note to HR.  
Thank you for your understanding,  
John Smith  
.</td>
      <td>The client transmits the email text, includes a line break after Subject: Sick leave, and ends the message with a single full stop (.) to indicate completion.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>250 OK: queued as 15432</td>
      <td>The server confirms the successful receipt of the email and places it in the queue.</td>
    </tr>
    <tr>
      <td>Client</td>
      <td>QUIT</td>
      <td>The client signals the end of the session.</td>
    </tr>
    <tr>
      <td>Server</td>
      <td>221 Goodbye</td>
      <td>The server terminates the connection.</td>
    </tr>
  </tbody>
</table>

## What are the disadvantages of the SMTP protocol?

Despite its widespread use, SMTP has several inherent disadvantages:

**No standardised delivery confirmation**

- SMTP does not inherently provide **reliable delivery confirmation**.
- Servers can provide feedback (e.g., [delivery status notifications](https://www.ionos.com/en-ie/digitalguide/e-mail/technical-matters/the-e-mail-header-and-its-role-in-the-world-of-spam/)), but their formatting is inconsistent and often difficult to understand.
- The result: It is difficult to identify the **exact cause of a failed delivery** (e.g., typo in the address, full mailbox).

**Lack of authentication at the origin**

- SMTP originally does not include **user authentication**. Theoretically, anyone can send an email with any sender address.
- This problem led to massive amounts of [spam](https://www.ionos.com/en-ie/digitalguide/e-mail/e-mail-security/how-to-recognize-spam-emails-and-prevent-them/) and spoofing (forging sender addresses).

To prevent misuse, providers today almost exclusively rely on SMTP AUTH (user authentication with login credentials), **TLS encryption** (STARTTLS, port 587 or port 465), and the **rejection of open relays**.

Note Many providers, such as Microsoft 365, are increasingly replacing basic authentication (username + password) in SMTP AUTH with **OAuth 2.0**. When setting up your mail client, check if this secure login method is supported.

**Vulnerability to spam &amp; spoofing**

- Without additional protection mechanisms, attackers can send emails on behalf of other domains.
- Modern security standards that mitigate this issue include the previously mentioned SPF, DKIM, and DMARC.
- MTA-STS (Mail Transfer Agent Strict Transport Security) ensures that emails are transmitted only over encrypted connections.
- DANE (DNS-based Authentication of Named Entities) provides additional security for TLS certificates via DNSSEC.

Thanks to these extensions, SMTP, in combination with ESMTP and modern security standards, is now significantly more reliable and secure than it was a few years ago.

## What is ESMTP?

In response to the security vulnerabilities and limitations of the original SMTP, the **Extended Simple Mail Transfer Protocol (ESMTP)** was introduced in 1995. ESMTP adds additional commands and options to SMTP, making email transmission **safer, more flexible, and more efficient**.

### Key features of ESMTP

- **Authentication** of the sender via SMTP AUTH to prevent spoofing and spam.
- **TLS encryption** via STARTTLS to ensure messages are protected during transmission.
- **Attaching multimedia files** (e.g., images, videos, documents).
- **Size restrictions** according to server specifications (e.g., `SIZE`).
- **Parallel sending to multiple recipients**.
- **Standardised error messages** for undeliverable mail.
- **Support for 8-bit content** with the `8BITMIME` extension, allowing special characters and UTF-8 symbols to be transmitted directly.

### Examples of ESMTP commands

<table>
  <thead>
    <tr>
      <th>ESMTP command</th>
      <th>Meaning</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>EHLO</td>
      <td>Alternative to HELO. Registers the client and checks if the server supports ESMTP.</td>
    </tr>
    <tr>
      <td>AUTH</td>
      <td>Authentication of the sender (e.g., via username/password).</td>
    </tr>
    <tr>
      <td>STARTTLS</td>
      <td>Negotiation of an encrypted connection (TLS).</td>
    </tr>
    <tr>
      <td>SIZE</td>
      <td>Server indicates the maximum allowable email size in bytes.</td>
    </tr>
    <tr>
      <td>8BITMIME</td>
      <td>Allows the transmission of messages with 8-bit ASCII or UTF-8.</td>
    </tr>
  </tbody>
</table>

Summary In practice, people generally refer to **SMTP** today, although nearly all modern mail servers use **ESMTP** with its extensions. These features—especially authentication and encryption—are what make email transmission secure and reliable.


This is a markdown version of: [https://www.ionos.com/en-ie/digitalguide/e-mail/technical-matters/smtp/](https://www.ionos.com/en-ie/digitalguide/e-mail/technical-matters/smtp/) for AI/LLM consumption.