Learn

SMTP vs email API: which should developers use?

Updated September 25, 2026

In short

Use an email API for application email when you can: it is one HTTPS request, errors come back immediately as structured JSON, it works where outbound SMTP ports are blocked, and delivery events arrive as webhooks. Use SMTP when the software sending the mail only speaks SMTP - a CMS, a legacy framework, a device - or when you need to switch providers by changing a hostname. Both deliver the same email; the difference is how your code talks to the provider.
Sending one email over SMTPYour appSMTP serverEHLO app.acme.com250 capabilitiesSTARTTLS220 readyAUTH PLAIN …235 authenticatedMAIL FROM, RCPT TO250 OKDATA + MIME message250 queuedA bounce arrives later,as an email to MAIL FROMSending one email through an email APIYour appEmail APIPOST /v1/emailsBearer sp_… + JSON200 { id }or 4xx { error.type }Delivery, bounce and complaintarrive as signed webhooks

Swipe the diagram to see the rest

The same email sent two ways. SMTP is a conversation of many round trips, and a bounce comes back later as another email. An API is one request with a structured answer, and delivery events arrive as webhooks.

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 APISMTP relay
TransportHTTPS, port 443SMTP, ports 587, 465 or 25
AuthAPI key in a headerUsername and password (often an API key as the password)
PayloadJSON; the provider builds the MIME messageYou build the MIME message: headers, boundaries, encoding
ErrorsImmediate, typed: domain_not_verified, suppressed_recipientReply codes; some failures only arrive later as bounce emails
Round trips per emailOne requestSeveral commands per message (fewer when you reuse the connection)
Delivery eventsSigned webhooks, logs, an id per messageUsually a bounce mailbox to parse, or the provider's webhooks
IdempotencyIdempotency-Key header makes retries safeNo standard; a retry after a timeout can send twice
BatchingAn array of messages in one requestPipelining on one connection
Blocked byAlmost nothingCloud 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:

An API error your code can branch on
HTTP/1.1 403
{
  "error": {
    "type": "domain_not_verified",
    "message": "The domain `mail.acme.com` is not verified yet."
  }
}
Sendpository Logs page filtered to 4xx responses, each with an error type such as validation_error, permission_denied and domain_not_verified
Every API request is logged with its status and error type, so a failed send can be found and explained after the fact.

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 422 with a field name beats a 550 bounce 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 trueChoose
You are writing the sending code yourself, todayAPI
The sender is WordPress, a CMS, a printer or a monitoring toolSMTP
You deploy to serverless, edge or a locked-down containerAPI - outbound SMTP ports are usually blocked
You need delivery and bounce events in your own systemAPI - webhooks, no mailbox parsing
You want to change provider without touching codeSMTP
You need to receive email as well as send itAPI - inbound is HTTP either way
You already run a local MTA and want a relay behind itSMTP

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.

Questions

Are email APIs better than SMTP?

Better for application code you are writing now: immediate structured errors, no blocked ports, and delivery events as webhooks. Not better as an interface - SMTP is the portable one, understood by every provider and every mail tool, so a provider switch is a credentials change rather than a rewrite. Pick per sender, not per company.

What is an SMTP API?

The phrase means one of two things: a provider's HTTP API offered alongside their SMTP relay, or an SMTP relay managed through an HTTP control plane. Sendpository is an HTTPS API for sending and receiving, with no SMTP relay - if your sender only speaks SMTP, a provider offering a relay is the better fit.

Should I choose SMTP or an API for my app?

An API if you are writing the sending code, deploying to serverless or a container, or need delivery events in your own system. SMTP if the sender is software you do not control - a CMS, a device, a monitoring tool - or if you want to switch providers by editing config. Many teams run both.

Is an email API faster than SMTP?

For your application, usually yes: one HTTPS request instead of several SMTP commands, and no MIME building. Delivery to the recipient is SMTP either way, so end-to-end time is similar.

Is SMTP deprecated?

No. SMTP is how every mail server on the internet talks to every other, and it isn't going anywhere. The question is only whether your application should speak it directly or hand mail to a provider over HTTPS.

Can I use an email API from a serverless function?

Yes, and it is the better fit: HTTPS works from any serverless runtime, while outbound SMTP ports are often restricted there.

Related

Send your first email in minutes

6,000 emails a month (up to 200 a day), free forever. No card needed.