Sending

SMTP vs API for sending email

Short answer

Use an email API when you write the code: one HTTPS request per email, clear JSON errors, an id for every message and delivery events by webhook. Use SMTP when the sender only speaks SMTP, such as a CMS plugin, a printer or an old app. Most providers, including Amazon SES and SendGrid, offer both, deliver through the same infrastructure, and apply the same deliverability rules, so inbox placement does not depend on which one you choose.

Last checked 16 November 2026

An email API is the better default when you write the sending code yourself. SMTP is the right choice when the software that sends mail only speaks SMTP, such as WordPress plugins, printers, monitoring tools and older frameworks. Most email providers offer both, and both deliver through the same servers, so the choice is about integration, not inbox placement.

SMTP vs API at a glance

Email API (HTTPS) SMTP
Transport HTTPS on port 443 SMTP on 587, 465 or 25
Round trips per message One request Connect, TLS, login, MAIL, RCPT, DATA, unless pooled
Blocked by firewalls Rarely, it is ordinary web traffic Often, especially port 25
Errors JSON with a type, message and field Three-digit reply code plus text
Message id Returned in the response Sometimes in the 250 reply, varies by provider
Batch sending Many emails per request, where offered One transaction per message
Retries Safe with an idempotency key Can send duplicates after a timeout
Works with existing software Needs code Any app with SMTP settings
Delivery events Webhooks tied to the returned id Webhooks, if the provider maps them back to your message

How an API send works

You make one HTTPS request with JSON, and the provider answers straight away with an id. Here it is with curl against Mailcandor’s email API:

curl https://api.mailcandor.com/v1/emails \
  -H "Authorization: Bearer $MAILCANDOR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042-receipt" \
  -d '{
    "from": "Acme <billing@acme.com>",
    "to": "sam@example.com",
    "subject": "Your receipt for order 1042",
    "html": "<p>Thanks for your order.</p>",
    "tags": [{ "name": "type", "value": "receipt" }]
  }'

The response is 202 with {"id": "...", "status": "queued"}. If the request is wrong, you get an error object that names the field, for example a missing subject. If your code times out and retries with the same Idempotency-Key, the second call returns the first result instead of sending twice.

That last point matters more than it sounds. With SMTP, a timeout after DATA leaves you guessing: the server may or may not have accepted the message, and retrying can send a duplicate receipt.

How an SMTP send works

An SMTP client opens a TCP connection, upgrades it to TLS, logs in, then walks through a short conversation defined in RFC 5321:

EHLO app.acme.com
AUTH PLAIN ...
MAIL FROM:<billing@acme.com>
RCPT TO:<sam@example.com>
DATA
(headers and body)
.
QUIT

Each line waits for a reply code. Libraries such as Nodemailer, PHPMailer and Python’s smtplib hide this, and connection pooling removes most of the overhead when you send many messages. The upside is universality: anything that has “SMTP settings” can use it, with no code.

When to choose an API

  • You are writing the integration yourself, in any language with an HTTP client.
  • You run on serverless platforms where long-lived connections are awkward.
  • Your host blocks outbound SMTP ports.
  • You want batch sends, scheduling, tags and idempotent retries.
  • You want clean, structured errors in your logs.

When to choose SMTP

  • The sender is off-the-shelf software: WordPress, Ghost, Jira, a monitoring tool, a printer.
  • You are migrating an app that already uses an SMTP library and want the smallest change.
  • Your framework’s mailer is built around SMTP and you would rather configure than code.

The pragmatic answer for many teams is both: the API for the product, SMTP for the tools around it, on one provider and one verified domain.

SMTP relay vs SMTP server

People use these terms loosely.

  • An SMTP server is any software that speaks SMTP, whether it receives mail for a domain, accepts submissions from clients, or delivers outbound.
  • An SMTP relay is an SMTP server whose job is to accept your mail and deliver it onward to recipients’ mail servers. It handles DNS lookups, retries, DKIM signing, bounce processing and IP reputation.

Running your own outbound SMTP server means owning all of that, plus port 25 access and a clean IP. Using a relay means you submit on 587 or 465 and the provider does the rest. For almost every app, a relay is the right call.

Amazon SES and SendGrid: API vs SMTP

Both providers offer both interfaces, and in both cases they share the same sending pipeline:

  • Amazon SES accepts mail through its API (and the AWS SDKs) or through its SMTP interface. The SMTP interface uses separate SMTP credentials that you generate in the SES console, not your normal AWS access keys.
  • SendGrid offers its v3 Mail Send API and an SMTP relay at smtp.sendgrid.net, where the username is the literal string apikey and the password is an API key.

So “SendGrid vs SMTP” is not really a choice between a provider and a protocol. It is a choice of which door to use on the same provider.

Does the choice affect deliverability?

No. Inbox placement depends on SPF, DKIM and DMARC for your domain, your bounce and complaint rates, and what you send. Those are identical whether the message arrived at the provider over HTTPS or SMTP. Choose the interface that fits your code, then put the effort into domain authentication.

Mailcandor offers both on every plan: the REST API at https://api.mailcandor.com/v1 and an SMTP relay at smtp.mailcandor.com on port 465 or 587, username mailcandor, password an API key. Both use the same verified domains and API keys.

Questions

Is an email API faster than SMTP?

Usually, per message. An API call is one HTTPS request. SMTP needs a TCP connection, a TLS handshake, login and several commands for each message unless you keep connections open and pool them.

Does SMTP or API affect deliverability?

No. With the same provider, both paths go out through the same sending servers. Inbox placement depends on your domain authentication, list quality and content, not the protocol you used to submit.

What is the difference between an SMTP relay and an SMTP server?

An SMTP server is any program that speaks SMTP. An SMTP relay is a server that accepts mail from you and delivers it onward to recipients' servers, handling retries, signing and reputation for you.

Should I use the Amazon SES API or SMTP?

Both send through the same SES service. Use the API or an AWS SDK if you write the code; use the SES SMTP interface for software that only supports SMTP. SMTP needs separate SMTP credentials generated in the SES console.

Can I switch from SMTP to an API later?

Yes. Keep the same provider and domain, change the sending code, and compare delivery events for a few days. Your DNS records and reputation carry over.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.