Prompt
I'm building a Next.js app and need the simplest transactional email setup.
Latest observation
Sep 24, 2026
OpenAI APIWeb search: off
If you want the simplest transactional email setup for a Next.js app, the easiest path is usually:
Recommended stack
- Resend for sending email
- React Email for templating
- Next.js API route / server action to trigger sends
This is popular because it’s simple, developer-friendly, and works well with Next.js.
1) Install packages
npm install resend @react-email/components
If you want to build templates locally, also install React Email’s tooling:
npm install -D react-email
2) Create a Resend account and API key
- Sign up at resend.com
- Create an API key
- Add it to
.env.local
RESEND_API_KEY=your_api_key_here
3) Create a simple email template
Example: emails/welcome.tsx
import { Html, Body, Container, Heading, Text } from "@react-email/components";
export default function WelcomeEmail({ name }: { name: string }) {
return (
<Html>
<Body>
<Container>
<Heading>Welcome, {name}!</Heading>
<Text>Thanks for signing up.</Text>
</Container>
</Body>
</Html>
);
}
4) Send the email from a Next.js API route
Example for the App Router:
app/api/send-welcome/route.ts
import { Resend } from "resend";
import WelcomeEmail from "@/emails/welcome";
import { render } from "@react-email/components";
const resend = new Resend(process.env.RESEND_API_KEY!);
export async function POST(req: Request) {
const { email, name } = await req.json();
const html = await render(<WelcomeEmail name={name} />);
const data = await resend.emails.send({
from: "Your App <onboarding@yourdomain.com>",
to: email,
subject: "Welcome!",
html,
});
return Response.json(data);
}
5) Call the endpoint from your app
await fetch("/api/send-welcome", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "user@example.com",
name: "Alex",
}),
});
Notes
- You’ll need to verify a sending domain with Resend for production.
- For development, you can use Resend’s test/sandbox behavior depending on your setup.
- Keep email sending on the server only — never expose the API key in client code.
If you want even simpler
If you don’t care about templates yet, you can skip React Email and just send plain HTML:
await resend.emails.send({
from: "Your App <onboarding@yourdomain.com>",
to: email,
subject: "Welcome!",
html: "<p>Welcome, Alex!</p>",
});
If you want, I can give you a copy-paste Next.js starter for:
- App Router
- Pages Router
- React Email + Resend
- Nodemailer instead of Resend