Prompt
I'm building a Next.js app and need a straightforward email API.
Latest observation
Oct 2, 2026
GeminiWeb search: on
Resend is the standard recommendation for Next.js apps. It was built specifically for modern React/Next.js stack patterns, pairs natively with React Email (so you can design templates using JSX), and works out-of-the-box with App Router Server Actions or Route Handlers.
Quick Implementation Options
Option A: Next.js Server Action (Easiest)
If you are using Next.js App Router, you can handle sending straight inside a Server Action without creating a separate API route endpoint.
- Install SDK:
Bash
npm install resend
- Set environment variable in
.env.local:
Code snippet
RESEND_API_KEY=re_123456789
- Call in a Server Action (
app/actions.tsor inline):
TypeScript
"use server";
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
export async function sendEmail(formData: FormData) {
const email = formData.get("email") as string;
const { data, error } = await resend.emails.send({
from: "onboarding@resend.dev", // Replace with your domain once verified
to: email,
subject: "Welcome to our app!",
html: "<p>Thank you for signing up!</p>",
});
if (error) {
return { success: false, error };
}
return { success: true, data };
}
Option B: Route Handler (API Endpoint)
If you need a dedicated HTTP endpoint (e.g., POST /api/send):
TypeScript
// app/api/send/route.ts
import { NextResponse } from "next/server";
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
export async function POST(request: Request) {
try {
const { to, subject, body } = await request.json();
const data = await resend.emails.send({
from: "Acme <onboarding@resend.dev>",
to,
subject,
html: `<p>${body}</p>`,
});
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error }, { status: 500 });
}
}
Popular Alternatives
| Provider | Best For | Standout Feature | Free Tier |
|---|---|---|---|
| Resend | React / Next.js DX | Built-in React Email support, clean modern API | 3,000 emails/mo (100/day) |
| Postmark | High deliverability | Transactional focus with strict inbox guarantees | 100 emails/mo trial |
| SendGrid | Legacy / Scale | Massive platform with marketing suite integration | 100 emails/day |
| Nodemailer + SMTP | Self-hosting / Zero cost | Standard Node.js library using any raw SMTP provider | Varies by SMTP host |