Skip to main content

Use this pre-built prompt to get started faster.

CursorOpen in Cursor

Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Get the Resend Node.js SDK.
npm install resend

2. Send email using HTML

The easiest way to send an email is by using the html parameter.
server.ts
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");
});

3. Try it yourself

Basic Send

Basic email sending

Attachments

Send emails with file attachments

Inline Images (CID)

Embed inline images using CID

Templates

Send emails using Resend hosted templates

Scheduling

Schedule emails for future delivery

Prevent Threading

Prevent email threading on Gmail

Audiences

Manage contacts and audiences

Domains

Create and manage sending domains

Inbound Webhooks

Receive and process inbound emails

Double Opt-in

Double opt-in subscription flow