Skip to main content

Prerequisites

To get the most out of this guide, you’ll need to:
You can find your API keys in your SendPost Dashboard. Make sure to use your Sub-Account API Key for sending emails.

1. Install Supabase CLI

2. Initialize Supabase Project

3. Create Edge Function

Create a new edge function:
This creates a directory structure:

4. Basic Email Function

Update supabase/functions/send-email/index.ts:
TypeScript

5. Set Environment Variables

Set the secret in Supabase:
Or via Supabase Dashboard:
  1. Go to Project Settings → Edge Functions
  2. Add secret: SENDPOST_API_KEY

6. Deploy Function

Deploy the function:

7. Common Use Cases

Welcome Email Function

Create supabase/functions/welcome-email/index.ts:
TypeScript

Password Reset Email

Create supabase/functions/password-reset/index.ts:
TypeScript

8. Invoke Function

From Client

TypeScript

Via HTTP

9. Testing Locally

Run locally:
Test:
Make sure your sender email domain is verified in your SendPost account before sending emails.

10. Next Steps

Explore more examples and use cases:

Supabase Edge Functions

Learn more about Supabase Edge Functions

Deno Documentation

Learn more about Deno runtime

Quickstart Example

View a complete working example on GitHub