RedwoodJS

Send email from Redwood API functions and services.

Send email from Redwood API functions and services.

Install

$npm i resent.one

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

Send an email

1// api/src/services/emails/emails.ts
2import { Resent } from "resent.one";
3
4export const sendWelcome = async ({ to }) => {
5 const resent = new Resent(process.env.RESENT_API_KEY);
6 return resent.emails.send({
7 from: "Acme <noreply@yourdomain.com>",
8 to,
9 subject: "Hello from RedwoodJS",
10 html: "<strong>It works!</strong>",
11 });
12};

Next steps