Comprehensive examples for sending emails with Resend using RedwoodJS.
- Node.js 22+
- A Resend account
# Choose your variant
cd typescript # or javascript
# Install dependencies
npm install
# Copy environment variables
cp ../.env.example .env
# Add your Resend API key to .envcd typescript
npm run devcd javascript
npm run devRedwoodJS uses serverless functions at /.redwood/functions/:
POST /api/send— Send an emailPOST /api/sendAttachment— Send with file attachmentPOST /api/sendCid— Send with inline CID imagePOST /api/sendScheduled— Schedule an emailPOST /api/sendTemplate— Send with templatePOST /api/webhook— Handle Resend webhook eventsGET/POST /api/domains— List/create domainsGET /api/audiencesContacts— List audience contactsPOST /api/doubleOptinSubscribe— Subscribe with confirmationPOST /api/doubleOptinWebhook— Confirm subscription on click
import { Resend } from "resend";
const resend = new Resend("re_xxxxxxxxx");
const { data, error } = await resend.emails.send({
from: "Acme <[email protected]>",
to: ["[email protected]"],
subject: "Hello",
html: "<p>Hello World</p>",
});
console.log("Email ID:", data?.id);redwoodjs-resend-examples/
├── typescript/
│ ├── api/
│ │ └── src/
│ │ ├── functions/ # Serverless API functions
│ │ └── lib/resend.ts # Resend client
│ ├── web/
│ │ └── src/
│ │ ├── pages/ # Page components
│ │ ├── layouts/ # Layout components
│ │ ├── components/ # Shared components
│ │ └── Routes.tsx # RedwoodJS router
│ ├── redwood.toml
│ └── package.json
├── javascript/
│ ├── api/
│ │ └── src/
│ │ ├── functions/ # Serverless API functions
│ │ └── lib/resend.js # Resend client
│ ├── web/
│ │ └── src/
│ │ ├── pages/ # Page components
│ │ ├── layouts/ # Layout components
│ │ ├── components/ # Shared components
│ │ └── Routes.jsx # RedwoodJS router
│ ├── redwood.toml
│ └── package.json
├── .env.example
└── README.md
See something that could be improved? We welcome contributions! Open an issue to report a bug or suggest an improvement, or submit a pull request with your changes.
MIT