scribase
Scribase Mail

Send email from a Supabase Edge Function

Supabase ships Postgres, auth and storage, but no email product, so sending usually means adding a separate vendor. A Supabase Edge Function is a Deno runtime, and Scribase Mail is a plain REST API, so no SDK install is needed inside the function.

Last checked November 24, 2026.

Write the function

Deno's fetch is global, so the function needs no dependency, no import map and no cold-start SDK download.

supabase/functions/send-email/index.tsts
// supabase/functions/send-email/index.ts
Deno.serve(async (req) => {
  const { to, subject, html } = await req.json();
  const response = await fetch('https://mail-api.scribase.com/emails', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${Deno.env.get('SCRIBASE_MAIL_KEY')}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      from: 'Acme <hello@mail.acme.com>',
      to,
      subject,
      html,
    }),
  });
  const data = await response.json();
  return Response.json(data, { status: response.status });
});

Set the key and deploy

Store the Scribase Mail key as a function secret; it never reaches the client.

sh
supabase functions deploy send-email
supabase secrets set SCRIBASE_MAIL_KEY=sk_live_...

Call it from your app

Invoke the function with the Supabase client, or trigger it from a Postgres webhook on insert.

ts
// Call it from your app with the Supabase client
const { data, error } = await supabase.functions.invoke('send-email', {
  body: { to: ['you@example.com'], subject: 'Hi', html: '<p>Hi</p>' },
});

Before sending real mail

Add and verify a sending domain (POST /domains, publish the DKIM/SPF/DMARC records, then verify) or use an sk_test_ key while building.

Scribase Mail plans (USD a month), from the live /billing/plans endpoint
PlanPriceEmails a monthDaily cap
Free$03,000 emails a month100 emails a day
Pro$2050,000 emails a monthNo daily cap
Scale$90150,000 emails a monthNo daily cap
FAQ

Questions people ask

Does this replace a Supabase feature?

No. Supabase itself has no email-sending product; this is the function wiring for calling any email API, including Scribase Mail, from Supabase's own edge runtime.

Can I run this on Scribase instead of Supabase?

Yes. Scribase bundles Postgres, auth, storage and Mail in one account, so the equivalent function and the email API it calls can both live on Scribase with no second vendor.

Do I need a verified domain to test the function?

No. An sk_test_ key sends with no verified domain; every send is simulated and never delivered, so the function and its caller can be exercised end to end before DNS work.