If email is the elec­tron­ic 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 au­then­ti­ca­tion and en­cryp­tion as standard.

Key Takeaways

  • SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending and for­ward­ing 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 des­ti­na­tion, 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 au­then­ti­ca­tion; today, SMTP AUTH, TLS, SPF, DKIM, and DMARC are meant to prevent misuse.
  • Nearly all modern mail servers use ESMTP, the extension of SMTP in­tro­duced in 1995.

What is the SMTP protocol?

SMTP stands for “Simple Mail Transfer Protocol”. It is a con­nec­tion-oriented, text-based network protocol from the internet protocol family, and it is situated on the seventh layer of the OSI model, the ap­pli­ca­tion layer. Like any other network protocol, it contains rules for proper com­mu­ni­ca­tion between computers in a network. SMTP is specif­i­cal­ly re­spon­si­ble for the sub­mis­sion and for­ward­ing 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, con­fig­u­ra­tion is almost automatic today: Modern clients like Outlook, Thun­der­bird, or webmail ap­pli­ca­tions 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:

Email provider SMTP server address SMTP port
Gmail smtp.gmail.com 587 (TLS/STARTTLS), 465 (SSL)
Microsoft 365 smtp.office365.com 587 (STARTTLS)
Outlook.com smtp-mail.outlook.com 587 (STARTTLS)
Yahoo Mail smtp.mail.yahoo.com 465 (SSL), 587 (TLS/STARTTLS)
AOL Mail smtp.aol.com 465 (SSL)
iCloud Mail smtp.mail.me.com 587 (TLS/STARTTLS), 465 (SSL)
Note

Port 25 (tra­di­tion­al 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.

Email hosting services tailored to your needs
  • Per­son­al­ized email address
  • Access your emails from anywhere
  • Highest security standards

How does the SMTP procedure work?

Un­der­stand­ing the SMTP procedure means un­der­stand­ing email. Basically, it works as follows:

Step 1: Sending the email to the SMTP server (sub­mis­sion)

  • The SMTP client, or the sender, uploads the email to the SMTP server, which is the email server (outgoing mail server) of the re­spec­tive provider.
  • This occurs through a webmail ap­pli­ca­tion in the browser or an email program (“Mail User Agent,” or MUA) like Outlook or Mozilla Thun­der­bird.
  • Nowadays, this transfer typically occurs over port 587 with STARTTLS en­cryp­tion and SMTP AUTH (username + password).

Step 2: Resolving the address via DNS

  • The sender’s SMTP server contacts the DNS server and de­ter­mines the IP address of the des­ti­na­tion SMTP server (MX record of the recipient’s domain).

Step 3: For­ward­ing 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 con­nec­tion is typically secured by TLS to prevent tampering and eaves­drop­ping.

Step 4: Ac­cep­tance at the des­ti­na­tion SMTP server

  • The des­ti­na­tion server (recipient mail server) checks if the mailbox exists.
  • Many mail servers ad­di­tion­al­ly check SPF, DKIM, and DMARC records to prevent spoofing and spam.
  • The email is tem­porar­i­ly 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 syn­chro­niza­tion between devices.
Image: Diagram of SMTP Process
The for­ward­ing of an email from the SMTP client through the server to the message storage of the des­ti­na­tion SMTP server is governed by the SMTP protocol. Only then do other network protocols come into play.

How does an SMTP session work?

The in­ter­ac­tion between the SMTP client and the SMTP server mentioned in the first step of the SMTP process con­sti­tutes 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 spec­i­fi­ca­tions (RFC 5321), every im­ple­men­ta­tion of the network protocol must support the following commands, con­sist­ing of 7-bit ASCII char­ac­ters; only EXPN is optional:

SMTP command Meaning
HELO “Hello.” – The client iden­ti­fies itself with the computer name and initiates the session.
EHLO Extended “Hello.” Requests the server’s ca­pa­bil­i­ties (ESMTP), such as STARTTLS or AUTH.
MAIL FROM Client specifies the sender of the email.
RCPT TO “Recipient” – The client specifies the recipient address of the email.
DATA Start of transfer (Header + Body).
RSET Abort transfer, con­nec­tion remains open.
VRFY/EXPN “Verify”/“Expand” – Check if a mailbox exists / Dis­tri­b­u­tion list is expanded.
NOOP “Keep alive”: Prevents a timeout.
QUIT Ends the session.

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 in­di­cat­ing that the server has suc­cess­ful­ly executed the command:

Status code Plain text message
200 (Non-standard success response)
211 System status or system help request
214 Request for help with executing a command
220 Server is ready for the SMTP session
221 Server closing the con­nec­tion
250 OK – Command executed
251 OK – No local user present, mail will be forwarded
252 OK – Recipient address cannot be verified, trans­mis­sion will still be attempted
253 OK – Messages are set to “Pending”

Status codes in­di­cat­ing that the server un­der­stood the command but requires further in­for­ma­tion for pro­cess­ing:

Status code Plain text message
354 Server starts mail reception

Status codes in­di­cat­ing that the server has detected a temporary error, but the command might still be processed:

Status code Plain text message
421 Server not available, con­nec­tion will be ter­mi­nat­ed
450 Command not executed, mailbox not available
451 Command execution aborted due to local error
452 Command not executed due to in­suf­fi­cient system storage

Status codes in­di­cat­ing that the server has detected a fatal error and the command cannot be processed:

Status code Plain text message
500 Syntax error, command un­rec­og­nized
501 Syntax error in pa­ra­me­ters or arguments
502 Command does not exist
503 Invalid command sequence
504 Command parameter does not exist
521 Server is not accepting mails
530 Access denied
550 Command not executed, mailbox not found
551 No local user, try for­ward­ing
552 Command execution aborted, error in memory al­lo­ca­tion
553 Command not executed, invalid mailbox name
554 Trans­mis­sion failed
An email server that's secure, powerful, and reliable
  • Highest security standards
  • Automatic en­cryp­tion with SSL/TLS
  • ISO-27001 certified and geo-redundant data centers
  • IMAP & SMTP

SMTP example session

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

Role SMTP commands and status codes Ex­pla­na­tion
Server 220 smtp.example.com ESMTP Postfix After the con­nec­tion is es­tab­lished, the SMTP server iden­ti­fies itself.
Client HELO relay.example.com The SMTP client iden­ti­fies itself with its computer name.
Server 250 smtp.example.com, Hello The server confirms the login.
Client MAIL FROM:<john@company.com> The client specifies the sender’s address of the MUA.
Server 250 OK The server confirms.
Client RCPT TO:<boss@company.com> The client specifies the recipient’s address.
Server 250 OK The server confirms.
Client DATA The client initiates the trans­mis­sion of the email.
Server 354 End data with <CR><LF>.<CR><LF> The server starts receiving and indicates that the email text should be closed with a period (“.”).
Client From: "John Smith" <john@company.com>
To: Boss Company <boss@company.com>
Date: Friday, September 19, 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 un­der­stand­ing,
John Smith
.
The client transmits the email text, includes a line break after Subject: Sick leave, and ends the message with a single period (.) to indicate com­ple­tion.
Server 250 OK: queued as 15432 The server confirms the suc­cess­ful receipt of the email and places it in the queue.
Client QUIT The client signals the end of the session.
Server 221 Goodbye The server ter­mi­nates the con­nec­tion.

What are the dis­ad­van­tages of the SMTP protocol?

Despite its wide­spread use, SMTP has several inherent dis­ad­van­tages:

No stan­dard­ized delivery con­fir­ma­tion

  • SMTP does not in­her­ent­ly provide reliable delivery con­fir­ma­tion.
  • Servers can provide feedback (e.g., delivery status no­ti­fi­ca­tions), but their for­mat­ting is in­con­sis­tent and often difficult to un­der­stand.
  • The result: It is difficult to identify the exact cause of a failed delivery (e.g., typo in the address, full mailbox).

Lack of au­then­ti­ca­tion at the origin

  • SMTP orig­i­nal­ly does not include user au­then­ti­ca­tion. The­o­ret­i­cal­ly, anyone can send an email with any sender address.
  • This problem led to massive amounts of spam and spoofing (forging sender addresses).

To prevent misuse, providers today almost ex­clu­sive­ly rely on SMTP AUTH (user au­then­ti­ca­tion with login cre­den­tials), TLS en­cryp­tion (STARTTLS, port 587 or port 465), and the rejection of open relays.

Note

Many providers, such as Microsoft 365, are in­creas­ing­ly replacing basic au­then­ti­ca­tion (username + password) in SMTP AUTH with OAuth 2.0. When setting up your mail client, check if this secure login method is supported.

Vul­ner­a­bil­i­ty to spam & spoofing

  • Without ad­di­tion­al pro­tec­tion mech­a­nisms, attackers can send emails on behalf of other domains.
  • Modern security standards that mitigate this issue include the pre­vi­ous­ly mentioned SPF, DKIM, and DMARC.
  • MTA-STS (Mail Transfer Agent Strict Transport Security) ensures that emails are trans­mit­ted only over encrypted con­nec­tions.
  • DANE (DNS-based Au­then­ti­ca­tion of Named Entities) provides ad­di­tion­al security for TLS cer­tifi­cates via DNSSEC.

Thanks to these ex­ten­sions, SMTP, in com­bi­na­tion with ESMTP and modern security standards, is now sig­nif­i­cant­ly more reliable and secure than it was a few years ago.

What is ESMTP?

In response to the security vul­ner­a­bil­i­ties and lim­i­ta­tions of the original SMTP, the Extended Simple Mail Transfer Protocol (ESMTP) was in­tro­duced in 1995. ESMTP adds ad­di­tion­al commands and options to SMTP, making email trans­mis­sion safer, more flexible, and more efficient.

Key features of ESMTP

  • Au­then­ti­ca­tion of the sender via SMTP AUTH to prevent spoofing and spam.
  • TLS en­cryp­tion via STARTTLS to ensure messages are protected during trans­mis­sion.
  • Attaching mul­ti­me­dia files (e.g., images, videos, documents).
  • Size re­stric­tions according to server spec­i­fi­ca­tions (e.g., SIZE).
  • Parallel sending to multiple re­cip­i­ents.
  • Stan­dard­ized error messages for un­de­liv­er­able mail.
  • Support for 8-bit content with the 8BITMIME extension, allowing special char­ac­ters and UTF-8 symbols to be trans­mit­ted directly.

Examples of ESMTP commands

ESMTP command Meaning
EHLO Al­ter­na­tive to HELO. Registers the client and checks if the server supports ESMTP.
AUTH Au­then­ti­ca­tion of the sender (e.g., via username/password).
STARTTLS Ne­go­ti­a­tion of an encrypted con­nec­tion (TLS).
SIZE Server indicates the maximum allowable email size in bytes.
8BITMIME Allows the trans­mis­sion of messages with 8-bit ASCII or UTF-8.
Summary

In practice, people generally refer to SMTP today, although nearly all modern mail servers use ESMTP with its ex­ten­sions. These features—es­pe­cial­ly au­then­ti­ca­tion and en­cryp­tion—are what make email trans­mis­sion secure and reliable.

Reviewer

Go to Main Menu