Docs Get key
All server guides
Email Providers

Send application email with the Resend SDK

Send a controlled Resend message, check its data/error result, and retain the message identity for delivery reconciliation.

Reviewed

Install Resend’s official JavaScript SDK with npm install resend. Complete domain verification and provide RESEND_API_KEY, APP_FROM, and TEST_TO securely; all addresses must be approved before executing a live example.

Send and inspect the SDK result

import { Resend } from "resend";
for (const key of ["RESEND_API_KEY", "APP_FROM", "TEST_TO"]) {
  if (!process.env[key]) throw new Error(`Missing ${key}`);
}
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.emails.send({
  from: process.env.APP_FROM,
  to: [process.env.TEST_TO],
  subject: "Resend controlled test",
  text: "A message from the approved application identity.",
});
if (error) throw new Error("Resend rejected the send; inspect a redacted error");
console.log({ id: data?.id });

Save the application send intent before calling the provider and associate the returned ID with it. The SDK’s error branch matters even when the HTTP exchange completed successfully.

Verify delivery, not just acceptance

Inspect the Resend email log and controlled inbox. For production, process delivery/bounce evidence and apply suppression policy. Do not log sensitive email content to diagnose a permission or domain problem.

If using a documented idempotency facility, bind its key to a stable application operation rather than generating a fresh key for every retry. An ambiguous timeout otherwise needs reconciliation before a resend.

The official Node.js quickstart is the authority for the current SDK contract. MailKite’s SDK is a different transport; never send through both as an automatic “backup” without duplicate-prevention design.