All posts

How Email Works at Scale

Follow one message to the inbox and see what happens after 200 OK.

Email is everywhere.

It's such a part of our lives that you may never have asked, "How does email actually work?"

On the way to the inbox, your email moves through several systems you don't control, and each one can delay, defer, or refuse it. In this post, we'll follow one message from your app to the mailbox and look at five key details:

  1. Routing: how the message travels
  2. SMTP details: what the SMTP conversation looks like
  3. Scale: what changes at scale: queues, retries, and pacing
  4. Trust: how feedback, authentication, and reputation shape what happens next
  5. Cost: what you're paying for when you use an email service provider (ESP)

1. Routing: the message journey

It starts with a call from your app to send an email. When the call succeeds, you'll receive a 200 OK and an ID.

{
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}

The response means your email service provider (ESP) accepted your request, but nothing more. All the outbound sending work still remains. The entire flow looks like this:

After you receive a 200 OK, the ESP's mail transfer agent (MTA) takes over. It's the software that speaks SMTP to other servers. At Resend, the MTA is Forge, which we built from scratch. The MTA coordinates the remaining steps.

  1. Look up the recipient's MX records

    First, the MTA needs to locate the delivery address, which is found in the receiving domain's MX records in DNS.

    Servers are listed in order of preference, so the MTA can fall back to alternatives if the preferred server is unreachable.

  2. Contact the recipient's mail server

    With a delivery location identified, the MTA sends your message to the receiving server, which processes it and returns a response.

  3. Deliver the returned response

    The receiving server's SMTP response is returned by your ESP as the result of the delivery attempt (e.g., delivered, bounced). Your app can get that result as a webhook event, through an API, or as a dashboard metric.

During the entire process, two sets of identifying addresses travel together with your message:

  1. The envelope tells servers where to send it: the sender address that error reports go back to (MAIL FROM) and the recipients (RCPT TO).
  2. The headers and body are what the recipient sees: From, To, Subject, and the content.

The two addresses don't have to match. The envelope sender can differ from the visible From address, and blind-copied recipients appear only in the envelope.

2. SMTP details: the conversation

Servers hand email to each other with SMTP (Simple Mail Transfer Protocol), defined in RFC 5321.

The sending server issues commands in a fixed order, and the receiving server answers each one with a three-digit code. Here is a simplified session:

receiver: 220 mx.recipient.example Service ready
sender: EHLO mta.sender.example
receiver: 250 mx.recipient.example
sender: MAIL FROM:<bounces@mail.sender.example>
receiver: 250 OK
sender: RCPT TO:<jane@recipient.example>
receiver: 250 OK
sender: DATA
receiver: 354 Start mail input; end with <CRLF>.<CRLF>
sender: From: Example App <hello@sender.example>
sender: To: Jane <jane@recipient.example>
sender: Subject: Reset your password
sender:
sender: Use the link below to choose a new password.
sender: .
receiver: 250 OK

A real session also advertises extensions and usually negotiates encryption first. Reading the rest top to bottom:

  1. EHLO: The sending server introduces itself.
  2. MAIL FROM: The sending server names the envelope sender.
  3. RCPT TO: The sending server names a recipient. The receiving server can refuse here, for example, when the mailbox doesn't exist.
  4. DATA: The sending server sends the headers and body. A line containing only a period ends the message.

Under the RFC, the final 250 OK means the receiving server has taken responsibility for the message: it must deliver it or report a failure. The receiving inbox provider still decides whether the message lands in the inbox or the spam folder.

The first digit of a failure code tells the sender what to do next:

  • 4xx is a temporary failure, so the sender should try again later.
  • 5xx is a permanent failure, so the sender shouldn't repeat the same request.

Both codes describe one delivery attempt. A later attempt to the same address can succeed.

You may also hear about hard and soft bounces. Those terms aren't part of the SMTP specification. ESPs created them to help customers decide whether to keep sending to an address, and each ESP maps SMTP responses to them in its own way.

3. Scale: what changes with volume

Sending a handful of messages from one machine means one connection, one recipient domain, and a person watching the output. At scale, an ESP has to handle four more jobs.

Queues

Messages from many customers arrive at once, and a product launch or broadcast can add a large batch in minutes. Durable queues keep an accepted message from getting lost when traffic surges or a component fails.

Retries

Receiving servers are often busy, rate limiting, or briefly unreachable, so the sender has to queue the message and try again. RFC 5321 suggests waiting at least 30 minutes between attempts and giving up after at least 4 to 5 days.

It also says smarter strategies help, and what works in practice varies by receiver.

Pacing

Each inbox provider has its own limits on how fast mail can arrive. Send too fast and the provider starts deferring messages; send too slowly and delivery drags.

The ESP has to pace every provider at once and keep one customer's large campaign from holding up everyone else. Of course, as a sender, you also need to be careful about pacing, but your ESP manages this for every sender.

How to Warm Up a New Domain

Learn how to warm up a domain to avoid deliverability issues.

resend.com/blog/how-to-warm-up-a-new-domain

Operations

Someone has to watch queue health, recover from failures, and avoid sending the same message twice. If a sender times out waiting for the final reply, the receiver may already have accepted the message, and RFC 5321 warns this usually produces duplicates.

On the API side, idempotency keys solve the same problem.

4. Trust: how feedback shapes reputation

After the receiving server answers, the sender needs to know what happened, and the receiver needs a reason to trust the message.

Feedback

Every delivery attempt produces a signal: accepted, delayed, or bounced. Later, a recipient might mark the message as spam, which counts as a complaint.

Opens and clicks are positive signals, recorded through a tracking pixel and tracked links (see open and click tracking).

The ESP turns these signals into events, webhooks, and suppression of addresses that bounce permanently. Not every inbox provider shares every signal, so some gaps always remain.

Inbox placement

A success response means the receiving server accepted the message, and the provider's filters decide where it goes next. No ESP can guarantee inbox placement.

Authentication

SMTP has no built-in way to prove who sent a message, and RFC 5321 says mail can't be authenticated at the transport level. Three DNS-based standards fill the gap (our developer's guide covers each one):

  1. SPF lists the servers allowed to send for a domain.
  2. DKIM adds a cryptographic signature that receivers check against a public key in DNS.
  3. DMARC ties SPF and DKIM to the domain in the visible From address and tells receivers what to do when checks fail.

Reputation

Receivers decide whether to trust you based on your sending history: bounces, complaints, engagement, and consistency. As we've written before, inbox providers care more about domain reputation than IP reputation.

Abuse prevention

When one sender on shared infrastructure sends spam or phishing, providers may treat every sender on that infrastructure with more suspicion. The ESP has to spot suspicious activity, respond to reports, and act fast.

Resend works directly with IP and domain reputation providers, deny-list providers, and inbox-provider postmaster teams to protect recipients and keep legitimate mail moving.

5. Cost: what you're paying for

Here is the monthly cost of sending alone at four volumes:

Monthly emailsResend (published plan)SES, à la carteSES, Essentials plan
3,000 (100 per day max)$0 (Free)No free plan*No free plan*
100,000$35 (Pro)$10$16
500,000$350 (Scale)$50$80
1,000,000$650 (Scale)$100$160

* New AWS accounts can receive up to $200 in AWS Free Tier credits, which apply across eligible AWS services.

Prices as of December 3, 2026, from Resend and AWS. SES charges $0.10 per 1,000 emails à la carte, or $0.16 per 1,000 on the Essentials plan, where new accounts start. SES figures exclude attachment data and other AWS charges, and SES has no free monthly sending allowance.

On sending alone, SES costs less. To compare fairly, add up what you'd have to build around SES to match what Resend plans include:

Capability on Resend plansWhat a DIY build has to add
Webhooks with signed payloadsAn event pipeline and signed endpoint handling
Email logs with searchable historyStorage, indexing, and a UI to search it
Automatic suppression list and bounce detailsLogic to interpret bounces and complaints
Open and click trackingTracking links, redirects, and event storage
DKIM, SPF, and DMARC authenticationDomain setup flows and ongoing checks
Inbound emailReceiving, parsing, and attachment handling
Delivery metrics and the Email Metrics APIEvent aggregation, storage, and dashboards
MCP server, CLI, and agent-friendly docsYour own MCP server, CLI, and docs

None of that appears on a sending bill.

Neither do compute, storage, and monitoring for the pipeline; security work against leaked API keys, account takeover, and phishing; or support for when a message doesn't arrive. Someone also has to run all of it.

An AI agent can write the first version of the code. Someone still has to watch it and fix it when a provider starts deferring your mail, and that ongoing work is what an ESP's price covers.

Come join us

The world of email holds deeply challenging and exciting opportunities, especially when you serve millions of developers. If this work resonates with you, build with us.

We're hiring.

Resend Team at Resend Forward 2026

Resend Team at Resend Forward 2026

Related