Swipe the diagram to see the rest
The same email, two conversations
SMTP is a line-by-line conversation. Your client connects, introduces itself, upgrades to TLS, authenticates, names the sender and each recipient, then streams the MIME message. Each step waits for a reply code. An email API collapses that into one HTTPS request carrying JSON, and the provider speaks SMTP to the recipient's server on your behalf.
Either way, the leg that matters for delivery - from the provider to Gmail or Outlook - is SMTP. The choice is only about the first leg: how your application hands the message over.
Side by side
| Email API | SMTP relay | |
|---|---|---|
| Transport | HTTPS, port 443 | SMTP, ports 587, 465 or 25 |
| Auth | API key in a header | Username and password (often an API key as the password) |
| Payload | JSON; the provider builds the MIME message | You build the MIME message: headers, boundaries, encoding |
| Errors | Immediate, typed: domain_not_verified, suppressed_recipient | Reply codes; some failures only arrive later as bounce emails |
| Round trips per email | One request | Several commands per message (fewer when you reuse the connection) |
| Delivery events | Signed webhooks, logs, an id per message | Usually a bounce mailbox to parse, or the provider's webhooks |
| Idempotency | Idempotency-Key header makes retries safe | No standard; a retry after a timeout can send twice |
| Batching | An array of messages in one request | Pipelining on one connection |
| Blocked by | Almost nothing | Cloud providers and networks that restrict outbound SMTP ports |
Why errors are the real difference
With SMTP, a server can accept your message with 250 and only later discover it can't be delivered - and then the failure arrives as a new email, a bounce, sent to the envelope sender. Your application has to receive and parse that email to learn anything. With an API, everything the provider can know at request time comes back in the response, typed:
HTTP/1.1 403
{
"error": {
"type": "domain_not_verified",
"message": "The domain `mail.acme.com` is not verified yet."
}
}
Ports and firewalls
Port 25 is restricted by many hosting and cloud providers to fight spam, and some corporate networks block outbound SMTP entirely. Submission ports 587 and 465 are usually open but not everywhere - serverless platforms and locked-down containers are common trouble spots. HTTPS on 443 is open practically everywhere your code runs.
When SMTP is the right choice
- The sender only speaks SMTP: WordPress, many CMSs, monitoring tools, printers, older frameworks.
- You want a provider switch to be a config change - host, port, username, password - with no code.
- You already have a mature mail pipeline built on a local MTA and only need a relay.
Why teams move from SMTP to an email API
Not because SMTP is broken - it carries essentially all of the world's mail and will outlive every API built on top of it. Teams move for four specific reasons, and if none of them applies to you, your SMTP relay is fine.
- Errors arrive while the request is still open. A
422with a field name beats a550bounce discovered in a log an hour later. - Port 25, 465 and 587 are blocked on most serverless and container platforms. Port 443 is not.
- Delivery, bounce, open and complaint events arrive as signed webhooks instead of needing a mailbox to be parsed.
- One request carries attachments, headers, tags, an idempotency key and a scheduled send time, with no MIME assembly in your code.
The honest counterweight: SMTP is the portable interface. Any provider speaks it, so moving between them is a credentials change. An API ties you to one vendor's request shape - which is why the migration guides exist and why this one maps every field.
What people mean by an SMTP API
Two different things, which is why the phrase causes confusion. Sometimes it means a provider's HTTP API offered alongside their SMTP relay - the same account, two ways in. Sometimes it means an SMTP relay with an HTTP control plane for managing credentials, domains and logs, where mail still goes out over SMTP.
Sendpository is the first kind without the relay: an HTTPS API for sending and receiving, with domain verification, logs and webhooks in the same account. If your sender can only speak SMTP, a provider with a relay is the better fit, and this page says so above.
SMTP or API: how to choose in one minute
| If this is true | Choose |
|---|---|
| You are writing the sending code yourself, today | API |
| The sender is WordPress, a CMS, a printer or a monitoring tool | SMTP |
| You deploy to serverless, edge or a locked-down container | API - outbound SMTP ports are usually blocked |
| You need delivery and bounce events in your own system | API - webhooks, no mailbox parsing |
| You want to change provider without touching code | SMTP |
| You need to receive email as well as send it | API - inbound is HTTP either way |
| You already run a local MTA and want a relay behind it | SMTP |
Most applications end up with both: an API for the mail the application sends, and a relay for the one legacy tool that cannot be changed. That is a normal, healthy answer, not a failure to decide.
For code you are writing today, an API is less to build and easier to debug. Sendpository is API-only; frameworks with a mailer abstraction usually have an HTTP transport, and the guides show the plain HTTP call for Node.js, Python, PHP, Go, Ruby and Java.