Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

RedwoodJS + Resend Examples

Comprehensive examples for sending emails with Resend using RedwoodJS.

Prerequisites

  • Node.js 22+
  • A Resend account

Installation

# Choose your variant
cd typescript  # or javascript

# Install dependencies
npm install

# Copy environment variables
cp ../.env.example .env

# Add your Resend API key to .env

Development

TypeScript

cd typescript
npm run dev

JavaScript

cd javascript
npm run dev

API Endpoints

RedwoodJS uses serverless functions at /.redwood/functions/:

  • POST /api/send — Send an email
  • POST /api/sendAttachment — Send with file attachment
  • POST /api/sendCid — Send with inline CID image
  • POST /api/sendScheduled — Schedule an email
  • POST /api/sendTemplate — Send with template
  • POST /api/webhook — Handle Resend webhook events
  • GET/POST /api/domains — List/create domains
  • GET /api/audiencesContacts — List audience contacts
  • POST /api/doubleOptinSubscribe — Subscribe with confirmation
  • POST /api/doubleOptinWebhook — Confirm subscription on click

Quick Usage

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);

Project Structure

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

Resources

Contributing

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.

License

MIT