sendsend.email

Send email with Supabase Edge Functions

A server-side call to the SendSend API from your Supabase Edge Functions 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. Store the key as a secret: run `supabase secrets set SENDSEND_API_KEY=ss_live_...`, then deploy the function.
  3. Add this to supabase/functions/send/index.ts:
Deno.serve(async (req) => {
  const { to } = await req.json();
  const res = await fetch('https://api.sendsend.email/v1/emails', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${Deno.env.get('SENDSEND_API_KEY')}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({ from: 'Acme <hello@mail.acme.com>', to: [to], subject: 'Hello from Supabase', html: '<p>It works!</p>' }),
  });
  return new Response(await res.text(), { status: res.status, headers: { 'Content-Type': 'application/json' } });
});

Good to know