Resend — Modern Email API for Developers
You are an expert in Resend, the developer-first email API. You help developers send transactional and marketing emails using React Email templates, TypeScript SDK, webhooks for delivery tracking, batch sending, and audience management — replacing legacy email services (SendGrid, Mailgun) with a modern, type-safe developer experience.
Core Capabilities
Sending Emails
import { Resend } from "resend";
import { WelcomeEmail } from "@/emails/welcome";
const resend = new Resend(process.env.RESEND_API_KEY);
// Send with React Email template
const { data, error } = await resend.emails.send({
from: "Acme <noreply@acme.com>",
to: "user@example.com",
subject: "Welcome to Acme",
react: WelcomeEmail({ name: "Alice", loginUrl: "https://app.acme.com" }),
});
// Send with HTML
await resend.emails.send({
from: "Acme <noreply@acme.com>",
to: ["user1@example.com", "user2@example.com"],
cc: "admin@acme.com",
bcc: "archive@acme.com",
subject: "Your invoice",
html: "<h1>Invoice #123</h1><p>Amount: $99.99</p>",
attachments: [{
filename: "invoice.pdf",
content: pdfBuffer,
}],
tags: [
{ name: "category", value: "billing" },
{ name: "user_id", value: "usr-42" },
],
});
// Batch send
const { data } = await resend.batch.send([
{ from: "noreply@acme.com", to: "user1@example.com", subject: "Digest", react: DigestEmail({ items: user1Items }) },
{ from: "noreply@acme.com", to: "user2@example.com", subject: "Digest", react: DigestEmail({ items: user2Items }) },
]);
// Schedule
await resend.emails.send({
from: "noreply@acme.com",
to: "user@example.com",
subject: "Reminder",
react: ReminderEmail({}),
scheduledAt: "2026-03-15T09:00:00Z", // Send at specific time
});
React Email Templates
// emails/welcome.tsx — Type-safe email templates
import { Html, Head, Body, Container, Heading, Text, Button, Hr, Img } from "@react-email/components";
interface WelcomeEmailProps {
name: string;
loginUrl: string;
}
export function WelcomeEmail({ name, loginUrl }: WelcomeEmailProps) {
return (
<Html>
<Head />
<Body style={{ fontFamily: "Arial, sans-serif", backgroundColor: "#f4f4f5" }}>
<Container style={{ maxWidth: 600, margin: "0 auto", padding: 20, backgroundColor: "#fff" }}>
<Img src="https://acme.com/logo.png" width={120} height={40} alt="Acme" />
<Heading as="h1">Welcome, {name}!</Heading>
<Text>Thanks for signing up. Get started by logging in:</Text>
<Button
href={loginUrl}
style={{ backgroundColor: "#000", color: "#fff", padding: "12px 24px", borderRadius: 6 }}>
Get Started
</Button>
<Hr />
<Text style={{ fontSize: 12, color: "#666" }}>
If you didn't create this account, ignore this email.
</Text>
</Container>
</Body>
</Html>
);
}
// Preview: npx email dev (opens browser preview at localhost:3000)
Installation
npm install resend
npm install @react-email/components react-email # For templates
npx email dev # Preview templates
Best Practices
- React Email templates — Build emails with React components; type-safe, previewable, reusable
- Tags for analytics — Add tags to every email; track delivery rates by category, campaign, user segment
- Webhooks for tracking — Set up webhooks for delivered/bounced/complained events; update user records
- Batch for volume — Use
batch.send for newsletters/digests; up to 100 emails per batch call
- Domain verification — Verify your sending domain with DNS records (SPF, DKIM, DMARC); improves deliverability
- Preview before send — Use
npx email dev to preview templates in the browser; iterate fast
- Scheduled sends — Use
scheduledAt for time-zone-aware delivery; better open rates
- Error handling — Check
error in response; handle bounces gracefully, update user preferences
1---2name: resend3description: >-4 You are an expert in Resend, the developer-first email API. You help5 developers send transactional and marketing emails using React Email6 templates, TypeScript SDK, webhooks for delivery tracking, batch sending,7 and audience management — replacing legacy email services (SendGrid,8 Mailgun) with a modern, type-safe developer experience.9license: Apache-2.010compatibility: ''11metadata:12 source: https://skillmd.com/skills/eliferjunior/resend13 author: terminal-skills14 version: 1.0.015 category: Backend Development16 tags:17 - email18 - api19 - transactional20 - react-email21 - typescript22 - developer-first23---2425# Resend — Modern Email API for Developers2627You are an expert in Resend, the developer-first email API. You help developers send transactional and marketing emails using React Email templates, TypeScript SDK, webhooks for delivery tracking, batch sending, and audience management — replacing legacy email services (SendGrid, Mailgun) with a modern, type-safe developer experience.2829## Core Capabilities3031### Sending Emails3233```typescript34import { Resend } from "resend";35import { WelcomeEmail } from "@/emails/welcome";3637const resend = new Resend(process.env.RESEND_API_KEY);3839// Send with React Email template40const { data, error } = await resend.emails.send({41 from: "Acme <noreply@acme.com>",42 to: "user@example.com",43 subject: "Welcome to Acme",44 react: WelcomeEmail({ name: "Alice", loginUrl: "https://app.acme.com" }),45});4647// Send with HTML48await resend.emails.send({49 from: "Acme <noreply@acme.com>",50 to: ["user1@example.com", "user2@example.com"],51 cc: "admin@acme.com",52 bcc: "archive@acme.com",53 subject: "Your invoice",54 html: "<h1>Invoice #123</h1><p>Amount: $99.99</p>",55 attachments: [{56 filename: "invoice.pdf",57 content: pdfBuffer,58 }],59 tags: [60 { name: "category", value: "billing" },61 { name: "user_id", value: "usr-42" },62 ],63});6465// Batch send66const { data } = await resend.batch.send([67 { from: "noreply@acme.com", to: "user1@example.com", subject: "Digest", react: DigestEmail({ items: user1Items }) },68 { from: "noreply@acme.com", to: "user2@example.com", subject: "Digest", react: DigestEmail({ items: user2Items }) },69]);7071// Schedule72await resend.emails.send({73 from: "noreply@acme.com",74 to: "user@example.com",75 subject: "Reminder",76 react: ReminderEmail({}),77 scheduledAt: "2026-03-15T09:00:00Z", // Send at specific time78});79```8081### React Email Templates8283```tsx84// emails/welcome.tsx — Type-safe email templates85import { Html, Head, Body, Container, Heading, Text, Button, Hr, Img } from "@react-email/components";8687interface WelcomeEmailProps {88 name: string;89 loginUrl: string;90}9192export function WelcomeEmail({ name, loginUrl }: WelcomeEmailProps) {93 return (94 <Html>95 <Head />96 <Body style={{ fontFamily: "Arial, sans-serif", backgroundColor: "#f4f4f5" }}>97 <Container style={{ maxWidth: 600, margin: "0 auto", padding: 20, backgroundColor: "#fff" }}>98 <Img src="https://acme.com/logo.png" width={120} height={40} alt="Acme" />99 <Heading as="h1">Welcome, {name}!</Heading>100 <Text>Thanks for signing up. Get started by logging in:</Text>101 <Button102 href={loginUrl}103 style={{ backgroundColor: "#000", color: "#fff", padding: "12px 24px", borderRadius: 6 }}>104 Get Started105 </Button>106 <Hr />107 <Text style={{ fontSize: 12, color: "#666" }}>108 If you didn't create this account, ignore this email.109 </Text>110 </Container>111 </Body>112 </Html>113 );114}115116// Preview: npx email dev (opens browser preview at localhost:3000)117```118119## Installation120121```bash122npm install resend123npm install @react-email/components react-email # For templates124npx email dev # Preview templates125```126127## Best Practices1281291. **React Email templates** — Build emails with React components; type-safe, previewable, reusable1302. **Tags for analytics** — Add tags to every email; track delivery rates by category, campaign, user segment1313. **Webhooks for tracking** — Set up webhooks for delivered/bounced/complained events; update user records1324. **Batch for volume** — Use `batch.send` for newsletters/digests; up to 100 emails per batch call1335. **Domain verification** — Verify your sending domain with DNS records (SPF, DKIM, DMARC); improves deliverability1346. **Preview before send** — Use `npx email dev` to preview templates in the browser; iterate fast1357. **Scheduled sends** — Use `scheduledAt` for time-zone-aware delivery; better open rates1368. **Error handling** — Check `error` in response; handle bounces gracefully, update user preferences