Skip to main content

Resend for Transactional Email: A Practical Setup Guide (2026)

Quick Answer:

Resend is a developer-focused email API for transactional messages such as password resets, receipts and sign-up confirmations. You verify a sending domain with the DNS records Resend generates, install the `resend` SDK, and call `resend.emails.send()` from server code. It handles sending infrastructure, but inbox placement still depends on authentication, reputation and content.

Nitesh Raghav

Wed, 22 May' 24

Last updated: Fri, 16 Oct' 26

Password resets, order receipts, OTP codes and sign-up confirmations all have one thing in common: the user is waiting for them. These are transactional emails, and they need a different setup from a newsletter tool. Resend is one of the newer email APIs built for this job, with a small SDK and close ties to React Email for templates.

This guide covers what Resend does, how to set up a sending domain properly, working TypeScript code for Node.js, SvelteKit and Next.js, and the features worth using in production: webhooks, idempotency keys and batch sending. It ends with an honest look at deliverability and a few alternatives.

What Is Resend?

Resend is an email API. You send a request with a sender, recipient, subject and body, and Resend delivers it over its own sending infrastructure, so you don't run a mail server. The dashboard shows each email's status, your domains, API keys and webhooks.

Resend lists official SDKs for Node.js, PHP, Laravel, Python, Ruby, Go, Java, Rust and .NET, plus a Chat SDK adapter. Anything that can make an HTTPS request can also call the REST API directly. Check the SDK page for the current list, since it changes over time.

Step 1: Verify a Sending Domain

You can test with Resend's `onboarding@resend.dev` sender, but production mail has to come from a domain you have verified.

  1. Pick a subdomain. Resend recommends sending from a subdomain such as `updates.example.com` or `notifications.example.com` rather than your root domain. This keeps the reputation of your transactional mail separate from anything else you send, such as newsletters.
  2. Add the domain in the dashboard. Resend generates the SPF and DKIM records (`TXT` plus `MX` or `CNAME` records). Copy the exact names and values from the domain's Records tab into your DNS provider. They must match exactly what Resend generated.
  3. Wait for verification. According to Resend's domain guide, verification often completes within about 15 minutes, but DNS changes can take up to 72 hours to propagate.
  4. Add DMARC. DMARC isn't needed for verification, but you should add it. Resend's DMARC guide suggests starting with a monitoring-only record:
_dmarc.example.com  TXT  "v=DMARC1; p=none; rua=mailto:dmarcreports@example.com;"

Once your reports show that all legitimate mail passes, move to `p=quarantine` and then `p=reject`. To pass DMARC, an email must pass either SPF or DKIM with alignment. This matters for Gmail too: Google's sender guidelines require SPF, DKIM and DMARC from anyone sending 5,000 or more messages a day to Gmail accounts, with the From: domain aligned to the SPF or DKIM domain.

Step 2: Send Your First Email With the Node SDK

Install the SDK with `pnpm add resend` (or npm, yarn or bun) and put your key in an environment variable called `RESEND_API_KEY`. Never ship the key to the browser. Email sending belongs on the server.

typescript
import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send({
  from: 'Acme <hello@updates.example.com>',
  to: ['user@example.com'],
  subject: 'Your password reset link',
  html: '<p>Click <a href="https://example.com/reset?token=abc">here</a> to reset your password.</p>',
  text: 'Reset your password: https://example.com/reset?token=abc',
  replyTo: 'support@example.com',
  tags: [{ name: 'category', value: 'password_reset' }],
});

if (error) {
  console.error(error);
} else {
  console.log('Sent email', data?.id);
}

Note that the SDK returns `{ data, error }` instead of throwing on API errors, so always check `error`. The Node SDK uses camelCase options (`replyTo`, `scheduledAt`), and `to` accepts up to 50 addresses. If you leave out `text`, Resend generates a plain-text version from your HTML.

Step 3: Send From a Server Route

SvelteKit

In a standard SvelteKit project, put the send logic in a `+server.ts` endpoint and read the key from private env vars so it never reaches the client bundle.

typescript
// src/routes/api/welcome/+server.ts
import { json, error } from '@sveltejs/kit';
import { Resend } from 'resend';
import { RESEND_API_KEY } from '$env/static/private';
import type { RequestHandler } from './$types';

const resend = new Resend(RESEND_API_KEY);

export const POST: RequestHandler = async ({ request }) => {
  const { email, name } = await request.json();

  const { data, error: sendError } = await resend.emails.send({
    from: 'Acme <hello@updates.example.com>',
    to: [email],
    subject: `Welcome, ${name}`,
    html: `<p>Hi ${name}, thanks for signing up.</p>`,
  });

  if (sendError) {
    throw error(500, sendError.message);
  }

  return json({ id: data?.id });
};

In a real app, validate and escape `name` and `email` before using them, and protect the endpoint so it can't be used to send mail to arbitrary addresses.

Next.js (App Router) With React Email

Resend's Node SDK accepts a `react` option, which renders a React component into the email body. React Email provides components built for email clients. Its current setup installs the `react-email` package, which exports components such as `Html`, `Head`, `Body` and `Button`.

tsx
// emails/welcome.tsx
import * as React from 'react';
import { Html, Head, Body, Button } from 'react-email';

interface WelcomeEmailProps {
  firstName: string;
}

export function WelcomeEmail({ firstName }: WelcomeEmailProps) {
  return (
    <Html>
      <Head />
      <Body>
        <h1>Welcome, {firstName}!</h1>
        <Button href="https://example.com/dashboard">Open your dashboard</Button>
      </Body>
    </Html>
  );
}
typescript
// app/api/send/route.ts
import { Resend } from 'resend';
import { WelcomeEmail } from '../../../emails/welcome';

const resend = new Resend(process.env.RESEND_API_KEY);

export async function POST(request: Request) {
  const { email, firstName } = await request.json();

  const { data, error } = await resend.emails.send({
    from: 'Acme <hello@updates.example.com>',
    to: [email],
    subject: 'Welcome to Acme',
    react: WelcomeEmail({ firstName }),
  });

  if (error) {
    return Response.json({ error }, { status: 500 });
  }

  return Response.json(data);
}

Resend's Next.js guide passes the component as a function call (`WelcomeEmail({ firstName })`) rather than as JSX. If you're outside React, for example in a SvelteKit app, you can still use React Email templates: render them to an HTML string with React Email's async `render()` function and pass the result as `html`.

Step 4: Make Sends Safe to Retry With Idempotency Keys

Networks fail. If your server times out after Resend accepted the request, a naive retry sends the user a second receipt. Idempotency keys stop that. Pass one as the second argument to `send`:

typescript
await resend.emails.send(
  {
    from: 'Acme <billing@updates.example.com>',
    to: ['user@example.com'],
    subject: 'Your receipt for order #1042',
    html: '<p>Thanks for your order.</p>',
  },
  { idempotencyKey: 'order-receipt/1042' },
);

According to the idempotency docs, keys can be up to 256 characters and are kept for 24 hours. Repeating a request with the same key and payload returns the original response without sending again. Reusing a key with a different payload returns a `409` error. Build keys from something stable, such as an event type plus an order or user ID.

Step 5: Batch Sending

When one event triggers several different emails, `resend.batch.send()` sends up to 100 emails in a single API call. Each item can have its own recipient, subject and body.

typescript
const { data, error } = await resend.batch.send([
  {
    from: 'Acme <hello@updates.example.com>',
    to: ['alice@example.com'],
    subject: 'Your weekly summary',
    html: '<p>Hi Alice, here is your summary.</p>',
  },
  {
    from: 'Acme <hello@updates.example.com>',
    to: ['bob@example.com'],
    subject: 'Your weekly summary',
    html: '<p>Hi Bob, here is your summary.</p>',
  },
]);

The batch docs note that attachments aren't supported in batch requests yet. You can pass an idempotency key as the second argument to `batch.send` too.

Step 6: Track What Happens With Webhooks

"Sent" isn't the end of the story. Webhooks tell your app what happened next. Resend's event types include `email.sent`, `email.delivered`, `email.delivery_delayed`, `email.bounced`, `email.complained`, `email.failed`, `email.suppressed`, `email.opened` and `email.clicked`. At minimum, handle bounces and complaints so you stop emailing addresses that reject you or mark you as spam.

Webhooks are signed, and you should verify every request. The SDK's `resend.webhooks.verify()` throws on an invalid signature. It needs the raw request body, so read it with `request.text()` and don't parse it first.

typescript
// src/routes/api/webhooks/resend/+server.ts (SvelteKit)
import { Resend } from 'resend';
import { RESEND_API_KEY, RESEND_WEBHOOK_SECRET } from '$env/static/private';
import type { RequestHandler } from './$types';

const resend = new Resend(RESEND_API_KEY);

export const POST: RequestHandler = async ({ request }) => {
  const payload = await request.text();

  let event;
  try {
    event = resend.webhooks.verify({
      payload,
      headers: {
        id: request.headers.get('svix-id') ?? '',
        timestamp: request.headers.get('svix-timestamp') ?? '',
        signature: request.headers.get('svix-signature') ?? '',
      },
      webhookSecret: RESEND_WEBHOOK_SECRET,
    });
  } catch {
    return new Response('Invalid signature', { status: 400 });
  }

  if (event.type === 'email.bounced' || event.type === 'email.complained') {
    // Mark the address as undeliverable in your database
  }

  return new Response('OK');
};

What Resend Pricing Looks Like

As listed on resend.com/pricing in October 2026, the Free plan includes 3,000 emails a month with a limit of 100 emails a day. Pro starts at $20 a month for 50,000 emails with no daily limit, and Scale starts at $90 a month for 100,000 emails with a much higher domain allowance. Enterprise pricing is custom. Prices change, so check the page before you budget.

Deliverability: What Resend Can and Can't Do

No email provider can guarantee your messages land in the inbox. When Resend marks an email as delivered, it means the recipient's mail server accepted it. As Resend's own knowledge base explains, that server may still route it to spam, and inbox providers don't share how they filter.

What actually moves inbox placement is mostly in your control:

  • Authentication. SPF and DKIM verified, a DMARC record published, and the From: domain aligned.
  • Reputation. Send from a dedicated subdomain, ramp up volume gradually on a new domain, and keep bounce and complaint rates low. Resend's warm-up guide suggests keeping bounces below 4% and spam complaints below 0.08%. Google asks bulk senders to stay under 0.3%.
  • List hygiene. Use webhooks to stop sending to addresses that bounce or complain.
  • Content and links. Resend's Deliverability Insights checks whether link URLs match your sending domain, whether you include a plain-text version, whether you use a "no-reply" sender, and whether your message is large enough to be clipped by Gmail.
  • Tracking. For transactional mail, consider turning off open and click tracking, or use custom tracking subdomains. Resend notes that shared tracking domains can hurt deliverability.

Alternatives Worth Comparing

  • Postmark is built around transactional email and keeps transactional and broadcast mail on separate "Message Streams". Its pricing page lists a free developer tier of 100 emails a month.
  • SendGrid (part of Twilio) offers an email API and SMTP relay alongside a marketing campaigns product. It suits teams that want both in one vendor.
  • Amazon SES is pay-as-you-go email inside AWS. It's often the cheapest at high volume, but it expects more setup and monitoring from you. See the SES pricing page for current rates and plans.

The right choice usually depends on your stack, your volume and how much tooling you want included, more than on headline price.

Getting It Into Production

Resend's SDK is quick to wire up. The work that takes more care is everything around it: DNS and DMARC rollout, retry-safe sending, bounce handling and templates that render well across email clients. If you'd like help building transactional email into a web app or SaaS product, Tech Inject's web development team can help you plan and build it.

Sources

Frequently Asked Questions

A transactional email is triggered by something a specific user does, rather than sent to a list as a campaign. Examples include password resets, OTP codes, order confirmations, receipts and account notifications. Users expect them straight away and often need them to finish a task, so they're usually sent through an email API such as Resend, Postmark or Amazon SES.

Resend's docs list official SDKs for Node.js, PHP, Laravel, Python, Ruby, Go, Java, Rust and .NET, plus a Chat SDK adapter. Because Resend also exposes a REST API, any language that can make HTTPS requests can send email through it. Check the SDK page in the docs for the current list.

No. No provider can guarantee inbox placement. Resend reports an email as delivered once the recipient's server accepts it, and that server can still filter it to spam. Deliverability depends on SPF, DKIM and DMARC, your domain's reputation, low bounce and complaint rates, and clean, relevant content.

Pass an idempotency key as the second argument to `resend.emails.send()`, for example `{ idempotencyKey: 'order-receipt/1042' }`. Resend keeps keys for 24 hours. A repeat request with the same key and payload returns the original response without sending again.

Yes. In Node.js, you can pass a React Email component to the `react` option of `resend.emails.send()`. In frameworks that don't use React, such as SvelteKit, render the template to HTML with React Email's `render()` function and pass the result as `html`.