Next.js

Send transactional email from App Router route handlers or Server Actions.

Send transactional email from App Router route handlers or Server Actions.

Install

npm i resent.one

Set RESENT_API_KEY in your server environment. Keep the key off the client.

Send an email

// app/api/send/route.ts
import { Resent } from "resent.one";
export async function POST() {
const resent = new Resent(process.env.RESENT_API_KEY);
const result = await resent.emails.send({
from: "Acme <noreply@yourdomain.com>",
to: "you@example.com",
subject: "Hello from Next.js",
html: "<strong>It works!</strong>",
});
return Response.json(result);
}

Next steps