Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Get Started with Resend and Supabase

This guide helps you get started with Resend by:

To send emails with your Supabase project, 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.example.com instead of the root domain.
  2. Add the DNS records to your DNS provider (learn more about these records). Resend Domains page
  3. Click on Verify DNS Records to begin the verification process.
  4. Wait for the verification to complete (usually takes 5–10 minutes)

If you want to use Resend to send your Supabase Auth Emails, you have three options:

  1. Using the Resend Integration: simplest, but less customizable email templates.
  2. Custom Auth Functions: more customizable email templates, but requires more setup.
  3. Self-hosted with custom SMTP: only for those self-hosting Supabase.

Resend includes a pre-built integration with Supabase. Connecting Resend as your email provider will allow you to send your Supabase emails (for example, password resets and email confirmations) through Resend.

YouTube video player
  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. Add a sender name and click Configure SMTP Integration. Resend Integrations settings

Click on Supabase Dashboard to confirm the integration.

Resend Integrations settings

Benefit of using custom auth functions:

  • More control over the email sending process since you control the sending function.
  • More control over the email template using React Email or Resend Templates.

Note that this requires enabling Supabase Auth Hooks.

YouTube video player

Supabase Auth Hooks with Resend Templates

See the full source code.

Send with a custom SMTP server for self-hosting

Section titled “Send with a custom SMTP server for self-hosting”

If you're self-hosting Supabase, you can use a custom SMTP server to send your emails. Learn more here.

If you're using Supabase Edge Functions, you can add email sending to your function by using the Resend Node.js SDK. You can use these functions for Auth Emails (as shown above) or for other emails (for example, app notifications and account activity).

First, make sure you have the latest version of the Supabase CLI installed.

  1. Create Supabase function

    Create a new function locally:

    Bash
    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:

    Bash
    supabase functions start
    supabase functions serve resend --no-verify-jwt

    Deploy function to Supabase:

    Bash
    supabase functions deploy resend

    Open the endpoint URL to send an email:

    Supabase Edge Functions - Deploy Function

Supabase Edge Functions Example

See the full source code.

If you have any questions, please let us know at support@resend.com.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu