Express

Send email from Express route handlers.

Send email from Express route handlers.

Install

npm i resent.one

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

Send an email

import express from "express";
import { Resent } from "resent.one";
const app = express();
const resent = new Resent(process.env.RESENT_API_KEY);
app.post("/send", async (_req, res) => {
const result = await resent.emails.send({
from: "Acme <noreply@yourdomain.com>",
to: "you@example.com",
subject: "Hello from Express",
html: "<strong>It works!</strong>",
});
res.json(result);
});
app.listen(3000);

Next steps