Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

SupaSquad + Resend

A quick jumpstart to using Resend with Supabase for SupaSquad members.

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.

  1. Add a new domain to Resend.

    Go to the Domains Dashboard page and click on Add Domain.

  2. Add your domain name

    We recommend using a subdomain like updates.example.com.

  3. Add the DNS records to your DNS provider.

    Learn more about setting the required records or see the DNS provider guides for specific provider instructions.

  4. Confirm in your Dashboard.

    Click on I've added the records to begin the verification process.

    Resend Domains page

  5. Wait for the verification to complete.

    This usually takes 5–10 minutes.

As a member of the SupaSquad, you qualify for a discount on a paid Resend plan. Contact your Supabase representative to get your discount code.

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 (e.g., password resets, email confirmations) through Resend.

YouTube video player
  1. Navigate to the Integrations Settings Dashboard page.

  2. Connect your account to Supabase.

    Click Connect to Supabase and login to your Supabase account if prompted.

    Resend Integrations settings

  3. Add your API key.

    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

  4. Confirm the integration.

    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.

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 (e.g., app notifications, 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