SMTP (Simple Mail Transfer Protocol) is the foundation of email delivery. Understanding how SMTP works helps you troubleshoot delivery issues and understand the path an email takes from sender to recipient.
What is SMTP?
SMTP is the protocol used to send email between servers. When you send an email, your email client uses SMTP to transfer the message to your mail server. That server then uses SMTP to relay the message to the recipient's mail server. SMTP handles only sending; receiving is handled by other protocols (IMAP, POP).
How SMTP works
- Connection establishment. The sending server connects to the receiving server on port 25 (or 587 for submission, 465 for SMTPS).
- EHLO/HELO greeting. The sending server identifies itself with an EHLO (Extended Hello) or HELO command.
- MAIL FROM command. The sender specifies the return path (envelope sender).
- RCPT TO command. The sender specifies the recipient address. This can be repeated for multiple recipients.
- DATA command. The sender begins transmitting the message content (headers and body).
- Message transmission. The email content is transmitted, terminated by a line containing only a period.
- QUIT command. The connection is closed.
SMTP ports
Port 25: The standard SMTP port for server-to-server communication. Often blocked by ISPs to prevent spam.
Port 587: The standard port for message submission (client to server). Supports STARTTLS for encryption.
Port 465: Historically used for SMTPS (SMTP over SSL). Less common now but still supported by some services.
SMTP authentication
Modern SMTP servers require authentication to prevent abuse. Common authentication methods include:
PLAIN: Username and password sent in clear text (only over TLS).
LOGIN: Similar to PLAIN but with different command structure.
CRAM-MD5: Challenge-response authentication that avoids sending passwords in clear text.
OAUTHBEARER: OAuth 2.0 token-based authentication, increasingly common for modern services.
Common SMTP issues
Connection timeouts: Usually caused by network issues, firewall blocks, or overloaded receiving servers.
Authentication failures: Wrong credentials, authentication method not supported, or account issues.
Relay denied: The server refuses to relay the message to the destination, typically due to spam filtering or policy restrictions.
Rate limiting: The server limits how many messages can be sent in a time period to prevent abuse.
Temporary email and SMTP
Temporary email services receive mail via SMTP like any other mail server. The difference is in how they handle the mail after receipt — temporary services match incoming messages against active inboxes and discard messages for expired addresses. The SMTP protocol itself works identically.