Short answer: SMTP (Simple Mail Transfer Protocol) is the standard protocol mail servers use to send email to each other. Your app or email client hands the message to an SMTP server (usually on port 587), and that server delivers it to the recipient's mail server.
SMTP in one sentence
SMTP (Simple Mail Transfer Protocol) is the set of rules two mail servers use to hand a message from one to the other. It has been doing this job, largely unchanged, since 1982.
The handshake, step by step
When your app sends an email, roughly this happens:
- Connect. Your client opens a connection to the recipient's mail server, usually on port 587 or 465.
- Greet. The client says
EHLO, the server replies with what it supports. - Authenticate. The client proves who it is, usually with a username and password (an API key, in most modern providers).
- Declare sender and recipient.
MAIL FROMandRCPT TOtell the server who the message is from and where it is going. - Send the message.
DATAfollowed by the headers and body, ended with a single dot on its own line. - Close.
QUITends the session.
SMTP only delivers between servers, not to the inbox
SMTP's job ends once your message reaches the recipient's mail server. What happens after that — landing in the inbox, promotions tab, or spam folder — is decided separately, based on authentication (SPF, DKIM, DMARC) and sender reputation. See SPF, DKIM and DMARC explained.
Ports you'll actually use
| Port | Encryption | Use it for |
|---|---|---|
| 587 | STARTTLS (upgrades after connecting) | The standard choice for submitting mail from an app |
| 465 | TLS from the first byte | An older but still valid alternative, blocked by fewer networks in practice |
| 25 | Plaintext, or STARTTLS | Server-to-server relay only — most ISPs block outbound 25 for residential and cloud IPs |
Why your own SMTP server is usually a bad idea
Running your own mail server means managing IP reputation, blocklist monitoring, retry queues and bounce handling yourself. Most teams instead send through a relay — your app still speaks SMTP (or a REST API), but the provider owns the infrastructure and the reputation.