Integration

Send emails from Remix with Postkit

Send transactional emails from Remix loaders and actions. Works on any Remix runtime (Node, Deno, Cloudflare).

1. Set your API key

# .env
POSTKIT_API_KEY=pk_live_...

2. Send an email

typescript
// app/routes/send.tsx
import type { ActionFunctionArgs } from "@remix-run/node";
import { json } from "@remix-run/node";

export async function action({ request }: ActionFunctionArgs) {
  const formData = await request.formData();
  const to = formData.get("email") as string;
  const name = formData.get("name") as string;

  const res = await fetch("https://api.postkit.eu/v1/emails", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.POSTKIT_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      from: "hello@yourapp.eu",
      to,
      subject: "Welcome aboard!",
      html: `<h1>Welcome, ${name}!</h1>`,
    }),
  });

  return json(await res.json());
}

3. Handle webhooks

Postkit sends delivery events (sent, delivered, bounced, opened, clicked) via HMAC-SHA256 signed webhooks following the Standard Webhooks specification.

typescript
// app/routes/webhooks.postkit.tsx
// Same HMAC-SHA256 verification as the Next.js example above.

Start sending in under 5 minutes

Free plan. No credit card required.

Get Started Free