Why is SMTP used?

The Simple Mail Transfer Protocol (SMTP) is the standard protocol for sending emails across the internet. There are several key reasons why SMTP is widely used.

Why is SMTP used?


SMTP is built to be a reliable way to deliver emails. Key features that enable this include:

  • Retries – If a message fails to send for some reason, SMTP will queue it and retry sending it later automatically. This prevents emails getting “lost.”
  • Error handling – SMTP has defined error codes that help identify issues and ensure errors get handled properly.
  • Spooling – Email servers spool messages until they can be processed and sent. This prevents overflow or loss of messages at times of high volume.


SMTP enables interoperability between email servers and clients:

  • It allows emails to be exchanged between different mail servers, regardless of underlying system or software.
  • Clients can connect to any SMTP server to send emails. There is no restriction or need for specialized software.
  • The protocol can be implemented on any platform or programming language.

This gives complete flexibility in terms of components in an email system.

Established infrastructure

Because SMTP has been widely adopted for 40+ years, there is established infrastructure and systems in place supporting it:

  • Global DNS MX records to route mail between domains.
  • Server software like Sendmail and Postfix manage SMTP transactions.
  • Filtering software like SpamAssassin help block spam and viruses.
  • End-to-end encryption tools like TLS provide security.

No need to reinvent the wheel

SMTP has withstood the test of time and does its job of delivering emails reliably. Re-inventing this wheel serves little purpose when current infrastructure works well:

  • New protocols take significant effort to gain adoption.
  • Trillions of emails flow over SMTP annually, with established management tools.
  • Admins and developers know how to manage, secure and optimize SMTP delivery.


SMTP is simply responsible for message transfers between mail servers. It has no requirement as to email structure, content, or meta information. This gives developers complete flexibility in terms of what email can convey beyond just text. MIME extensions allow encoding attachments, images, and rich content.

This combination of reliability, ubiquity, infrastructure maturity, and flexibility is why SMTP remains the go-to protocol for email delivery after 40+ years of service.

How does SMTP work?

At a high level, this is the overall workflow of sending an email via SMTP:

  1. Email client connects to a mail server using SMTP and sends the sender, recipients, and message content.
  2. Mail server determines where to relay incoming messages based on destination domain.
  3. Server looks up the MX record of each recipient domain.
  4. Connects via SMTP to deliver each message to correct mail server.
  5. Recipient mail server receives and stores message in appropriate mail folder.
  6. Recipient can access the email using protocols like IMAP or POP3.

Breaking this down into more detail:

SMTP handshake

The SMTP client initiates a TCP connection to port 25 of the server to establish an SMTP session:

  1. Client > HELO mydomain.com
  2. Server > 250 Hello mydomain.com, I am mail.mydomain.com

This handshake verifies :

  • SMTP server is listening and reachable.
  • Client domain has a valid MX record.
  • Server is ready for bi-directional communication.

Mail transaction

With the session active, here is typical transaction:

  1. Client > MAIL FROM: [email protected]
  2. Server > 250 Sender address accepted
  3. Client > RCPT TO: [email protected]
  4. Server > 250 Recipient address accepted
  5. Client > DATA
  6. Server > 354 Start mail content
  7. Client sends formatted email including headers and body.
  8. Client > . (signals end of message)
  9. Server > 250 Message received OK

This transaction ensures:

  • Valid sender with authorization to use sending domain
  • Existence of recipient address
  • Relaying only after validation checks pass
  • Sending the formatted email content

Message routing

If the recipient is for a domain hosted on that SMTP server, it will deliver it to their mailbox directly.

Otherwise, route determination kicks in:

  • Based on the recipient address domain, DNS MX lookup retrieves the server for that domain.
  • Connection is opened to that SMTP server to relay/transfer the message.
  • On success, receiver sends acceptance response.

This routing allows delivery across domains and internet.

Message retrieval

For end user access, mailbox server provides IMAP and POP3 access protocols to download messages from a mailbox folder to an email client.

So in summary, SMTP handles server to server message transfers, while IMAP and POP handle client access.

SMTP architecture

It helps understand SMTP by visualizing how the different mail components connect:

  • Clients connect to mailbox servers to submit outgoing emails via SMTP.
  • Clients then use IMAP/POP to receive messages from these servers.
  • Mailbox servers use DNS records to route outgoing mail.
  • MTAs / Mail Transfer Agents act as SMTP relay servers between mailbox servers.
  • Routing can involve multiple hops via MTAs to reach the destination mail server.
  • This separates submission, access and routing into modular components.

So while users only see mail client submit and receive messages, there are backend transfers between mail servers to facilitate delivery over SMTP.

Alternatives to SMTP

Given its long history and entrenchment, SMTP is hard to replace broadly. But limitations have led to alternative proposals:


STARTTLS extension allows encrypting SMTP sessions with TLS. But impersonation is still possible during initial handshake before encryption begins.


SMTPS runs SMTP natively over TLS port 465, encrypting from start and preventing impersonation. But additional port is not always accessible.

Message submission

Port 587 provides authenticated SMTP submission and TLS transport as default. Does not fully replace SMTP but helps harden submission chain.


Sendmail used SMTP server capabilities for end-to-end mail delivery, not just relaying between servers. Helped enforce policies in SMTP transactions.

Microsoft Exchange

Replaced Sendmail with range of protocols for directory, authentication, transport and filtering built on SMTP standard. Tightly integrated system but costly.

In summary, SMTP’s network effect and existing infrastructure prevents large scale replacement. Enhancements focus on encryption and hardening vulnerabilities around initial handshakes and mail transactions.

Key takeaways

To recap the key points:

  • SMTP powers email delivery reliability with retries, error handling, spooling.
  • Interoperable design allows diverse servers, clients to exchange mail flexibly.
  • Mature infrastructure around SMTP processing means emails reliably flow.
  • Recreating delivery protocols is unnecessary when SMTP works at scale.
  • Extensions are addressing client vulnerabilities, encryption needs etc.

So building further on robust messaging fundamentals rather than replacing, SMTP retains its relevance despite age. The universal protocol and system guarantees your email reaches its audience efficiently.


SMTP may have been created in a time of limited networking but architects built an enduring protocol. Capabilities like stable mail routing, enqueueing and retries deliver reliability. Code and server ecosystem keep pace to address encryption, authentication needs. And universal interoperability allows new networks and devices seamless email access. Ambitious replacements exist but cannot match the convenience of standards. For reliably reaching inboxes everywhere, SMTP gets the mail delivered.

Frequently Asked Questions

  1. What port does SMTP use?
    SMTP commonly uses TCP port 25 for plain text communication. Ports 465 or 587 are also used with SSL/TLS encryption. 
  2. Who invented SMTP?
    SMTP traces origins back to the early ARPANET mail system. Standard RFC documents for SMTP were created in 1982 by researcher Jonathan B. Postel.
  3. What are SMTP commands?
    Common SMTP commands are HELO, EHLO, MAIL FROM, RCPT TO, DATA and QUIT. These help coordinate the client-server mail sending workflow. 
  4. Is SMTP insecure?
    Yes, basic SMTP has vulnerabilities because connections are unencrypted plain text. Extensions like SMTPS and SMTP/TLS implement transport encryption using SSL/TLS. 
  5. What is the difference between SMTP and SMTPS?
    SMTPS handles the entire session encrypted over port 465. SMTP initiates unencrypted and upgrades later using STARTTLS on port 25 or 587. 
  6. Can I use Gmail SMTP server?
    Yes, Gmail allows users to configure client SMTP access to send outgoing mails by authenticating via username/password. 
  7. What is the SMTP HELO command?
    HELO initiates the client server SMTP session by identifying sending domain. HELP confirms domain has a valid MX record. 
  8. What error codes does SMTP return?
    SMTP has standard response codes like 500 (syntax errors), 400 (bad requests), 252 (mailbox full), 221 (session done) to help understand issues. 
  9. How does SMTP over TLS work?
    The client sends STARTTLS command to upgrade SMTP session to encrypted TLS transport for secure transfer. 
  10. Why is SMTP still used?
    SMTP handles reliable and efficient email transport reliably at scale. Alternate mail transfer protocols cannot match its ubiquitous infrastructure. 
  11. How does SMTP ensure mail delivery?
    Built-in safeguards like message retries, queueing, error alerts allow SMTP systems to handle issues and guarantee message delivery. 
  12. What protocols work with SMTP?
    IMAP and POP3 allow accessing inboxes. SMTP routes mails between servers, while IMAP/POP manage end user mailbox access. 
  13. What are the disadvantages of SMTP?
    Lack of built-in encryption has opened vulnerabilities to snooping or spoofing. Authentication loopholes have led to exploits like spam and phishing. 
  14. How does SMTP authentication work?
    Authenticating SMTP Submission (port 587) requires clients provide credentials to confirm identity, improving security. 
  15. Why port 25 is blocked?
    ISPs often block port 25 except for their own SMTP servers as a spam prevention measure. Port 587 provides an alternative. 
  16. Can I run an SMTP server on my PC?
    Yes, platforms like Postfix, Sendmail or Exim can be installed on systems to configure them as full fledged SMTP servers. 
  17. What error does Connection Timed Out mean?
    This indicates the SMTP client failed to get a timely response from receiving server due to network issues or service outage. 
  18. Is Microsoft Exchange an SMTP server?
    Exchange includes a built-in SMTP service for routing mails internally and externally using standard SMTP mechanisms. 
  19. What is email spooling?
    Spooling queues incoming messages when server is busy, preventing refusal or losses, and feeds them for delivery when system Resources become available again. 
  20. How does SMTP delegate messages to another server?
    Route resolving via DNS MX records allows identifying target server for destination domain to relay mails to.

Leave a Comment