For the complete site index, see llms.txt. Docs index: llms-docs.txt. Marketing corpus: llms-full.txt. Docs corpus: llms-full-docs.txt. Prefer markdown URLs where available (append .md).. Product skill: skill.md. Pricing: pricing.md. Docs MCP: /docs/mcp. Site MCP: /mcp.

Tutorials/

Send Transactional Email from Remix

6 MINUTES READ

Summary

Add reliable transactional email to your Remix app using Reloop's Node.js SDK, from loader/action setup to environment variable handling.

Why Remix is different

Remix runs loaders and actions on the server by default, which means you can safely call the Reloop SDK without ever exposing your API key to the browser. No API routes, no extra setup. Just call it in the action.

Installation

bash
npm install reloop-email

Add your API key to .env:

env
RELOOP_API_KEY=re_your_api_key_here

Sending from an action

The most common pattern: trigger an email when a form is submitted:

app/routes/contact.tsx
1import { ActionFunctionArgs } from "@remix-run/node";
2import { Reloop } from "reloop-email";
3
4const reloop = new Reloop(process.env.RELOOP_API_KEY!);
5
6export async function action({ request }: ActionFunctionArgs) {
7 const formData = await request.formData();
8 const email = formData.get("email") as string;
9
10 await reloop.emails.send({
11 from: "hello@yourdomain.com",
12 to: email,
13 subject: "Thanks for reaching out",
14 html: "<p>We'll get back to you within 24 hours.</p>",
15 });
16
17 return { success: true };
18}

Sending from a resource route

For webhook-triggered emails or programmatic sends, use a resource route:

app/routes/api.send-welcome.ts
1import { json } from "@remix-run/node";
2import { Reloop } from "reloop-email";
3
4const reloop = new Reloop(process.env.RELOOP_API_KEY!);
5
6export async function action({ request }: { request: Request }) {
7 const { email, name } = await request.json();
8
9 await reloop.emails.send({
10 from: "onboarding@yourdomain.com",
11 to: email,
12 subject: `Welcome, ${name}!`,
13 html: `<p>Your account is ready. Let's get started.</p>`,
14 });
15
16 return json({ sent: true });
17}

Error handling

Wrap sends in try/catch and return structured errors to the client. Never let email failures crash your action. Degrade gracefully.

Next steps

  • Add React Email for beautiful HTML templates
  • Use Reloop's webhook events to track opens and clicks
  • See the Reloop SDK docs for the full API reference
W: 320.0px180R20∠45.0°

Ship your first email with Reloop
in minutes.

Open-source, deliverability-focused, and yours to self-host or run on Reloop Cloud. No lock-in, no rewrite later.

Reloop