Remix

Send email from Remix loaders and actions.

Send email from Remix loaders and actions.

Install

$npm i resent.one

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

Send an email

1// app/routes/send.tsx
2import { Resent } from "resent.one";
3import type { ActionFunctionArgs } from "@remix-run/node";
4
5export async function action({ request }: ActionFunctionArgs) {
6 const resent = new Resent(process.env.RESENT_API_KEY);
7 return await resent.emails.send({
8 from: "Acme <noreply@yourdomain.com>",
9 to: "you@example.com",
10 subject: "Hello from Remix",
11 html: "<strong>It works!</strong>",
12 });
13}

Next steps