Prompt

How to send email from Supabase Edge Functions

Technology / Api platforms5 observationsLast seen Sep 23, 2026

Latest observation

Sep 23, 2026CopilotWeb search: on

You can send email from Supabase Edge Functions by creating a Deno-based function that calls a transactional email API (like Resend, Sequenzy, or SendGrid). The function runs server-side, keeps your API key secure, and can be triggered by HTTP requests, database changes, or auth events.

🛠 Step-by-Step Setup

Create a new Edge Function

bash

supabase functions new send-email

This generates supabase/functions/send-email/index.ts.

Store API key securely

bash

supabase secrets set RESEND_API_KEY=re_your_api_key_here

Keys are stored in Supabase secrets, not in code.

Write the function

Example using Resend:

ts

const RESEND_API_KEY = Deno.env.get("RESEND_API_KEY");

Deno.serve(async (req) => {

if (req.method !== "POST") {

  • return new Response("Method not allowed", { status: 405 });

}

const { to, subject, body } = await req.json();

const response = await fetch("https://api.resend.com/emails", {

  • method: "POST",
  • headers: {
  • "Content-Type": "application/json",
  • Authorization: Bearer ${RESEND_API_KEY},

},

to,

subject,

  • html: body,

}),

});

return new Response(await response.text(), { status: response.status });

});

Test locally

bash

supabase start

supabase functions serve send-email --env-file .env.local

Then trigger with:

bash

curl -X POST http://localhost:54321/functions/v1/send-email \

  • -H "apikey: <SUPABASE_SECRET_KEY>"
    -d '{"to":"user@example.com","subject":"Hello","body":"<strong>It works!</strong>"}'

Deploy to Supabase

bash

supabase functions deploy send-email --no-verify-jwt

Make sure your API key is set in Supabase secrets before deploying.

⚠️ Best Practices

Use SPF/DKIM/DMARC for your sending domain to avoid spam folders.

Keep tokens short-lived if sending auth links.

Log errors and monitor bounce/complaint rates.

Trigger functions from auth hooks or database events for automation.

✅ Recommended Providers

Resend → Developer-friendly, simple transactional emails.

Sequenzy → SaaS-focused, supports sequences and automations.

SendGrid → Enterprise-grade, high-volume support.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (5 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.