Learn how to send your first email using Express and the Resend Node.js SDK.
npm install resend
html
import express, { Request, Response } from "express"; import { Resend } from "resend"; const app = express(); const resend = new Resend("re_xxxxxxxxx"); app.get("/", async (req: Request, res: Response) => { const { data, error } = await resend.emails.send({ from: "Acme <onboarding@resend.dev>", to: ["delivered@resend.dev"], subject: "hello world", html: "<strong>it works!</strong>", }); if (error) { return res.status(400).json({ error }); } res.status(200).json({ data }); }); app.listen(3000, () => { console.log("Listening on http://localhost:3000"); });
Was this page helpful?