Skip to main content
In this guide, we’ll help you get started by:
  1. Setting up Resend
  2. Connecting Resend to Supabase SMTP
  3. Adding email to a Supabase function

1. Setup Resend

In order to send from your own custom domain, you’ll need to first verify it in Resend. Go to the Domains page and click on Add Domain.
  1. Add your domain name (we recommend using a subdomain like updates.yourdomain.com).
  2. Add the DNS records to your DNS provider (learn more about these records). Resend Domains page
  3. Click on I’ve added the records to begin the verification process.
  4. Wait for the verification to complete (usually takes 5–10 minutes)
Resend requires you own your domain (i.e., not a shared or public domain). Adding DNS records gives Resend the authority to send emails on your behalf and signals to the inbox providers that you’re a legitimate sender.

2. Connect Resend to Supabase

Resend includes a pre-built integration with Supabase. Connecting Resend as your email provider will allow you to send your Supabase emails (i.e., password resets, email confirmations, etc.) through Resend.
  1. Open the Resend Integrations settings.
  2. Click Connect to Supabase and login to your Supabase account if prompted. Resend Integrations settings
  3. Select a project and click Select Project, then select your domain and click Add API Key. Resend will create an API key for you. Resend Integrations settings
  4. Add a sender name and click Configure SMTP Integration. Resend Integrations settings
  5. Click on Supabase Dashboard to confirm the integration. Resend Integrations settings
Supabase has a rate limit on the number of emails you can send per hour and requires you to connect a custom email provider for more than 2 emails/hour. Once you set Resend as your email provider, you can send additional emails (by default, 25 emails/hour, although you can change the rate limit in your project’s authentication settings).

3. Adding email to a Supabase function

If you’re using Supabase Edge Functions, you can add email sending to your function by using the Resend Node.js SDK. First, make sure you have the latest version of the Supabase CLI installed.

1. Create Supabase function

Create a new function locally:
supabase functions new resend

2. Edit the handler function

Paste the following code into the index.ts file:
index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

const RESEND_API_KEY = 're_xxxxxxxxx';

const handler = async (_request: Request): Promise<Response> => {
    const res = await fetch('https://api.resend.com/emails', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${RESEND_API_KEY}`
        },
        body: JSON.stringify({
            from: 'Acme <onboarding@resend.dev>',
            to: ['delivered@resend.dev'],
            subject: 'hello world',
            html: '<strong>it works!</strong>',
        })
    });

    const data = await res.json();

    return new Response(JSON.stringify(data), {
        status: 200,
        headers: {
            'Content-Type': 'application/json',
        },
    });
};

serve(handler);

3. Deploy and send email

Run function locally:
supabase functions start
supabase functions serve resend --no-verify-jwt
Deploy function to Supabase:
supabase functions deploy resend
Open the endpoint URL to send an email: Supabase Edge Functions - Deploy Function

4. Try it yourself

Supabase Edge Functions Example

See the full source code.

Happy Hacking!

If you have any questions, please let us know at support@resend.com or ask us during the hackathon.
I