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

// api/src/services/emails/emails.ts
import { Resent } from "resent.one";
export const sendWelcome = async ({ to }) => {
const resent = new Resent(process.env.RESENT_API_KEY);
return resent.emails.send({
from: "Acme <noreply@yourdomain.com>",
to,
subject: "Hello from RedwoodJS",
html: "<strong>It works!</strong>",
});
};

Next steps