sendsend.email

Send email with Remix

A server-side call to the SendSend API from your Remix app.

  1. Create a test API key in the dashboard first: it never delivers real email. Switch to a live key once your domain is verified.
  2. Add SENDSEND_API_KEY to .env and to your host’s environment variables.
  3. Add this to app/routes/send.tsx:
import type { ActionFunctionArgs } from '@remix-run/node';

export async function action({ request }: ActionFunctionArgs) {
  const form = await request.formData();
  const res = await fetch('https://api.sendsend.email/v1/emails', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.SENDSEND_API_KEY}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({ from: 'Acme <hello@mail.acme.com>', to: [String(form.get('email'))], subject: 'Welcome', html: '<p>Thanks for signing up!</p>' }),
  });
  return Response.json(await res.json(), { status: res.status });
}

Good to know