/supabase-tutorials

How to resend email confirmation in Supabase?

Resend your Supabase confirmation email effortlessly with our step-by-step guide covering project setup, SMTP config, API usage, and UI implementation.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to resend email confirmation in Supabase?

 

Step 1: Set up the Project Environment

 

Before you can resend an email confirmation in Supabase, make sure you have a project set up. If you haven't created one yet, go to the Supabase website and sign up or log in. Once logged in, create a new project from the dashboard. Remember to store the project's API URL and Anon key, as you'll need these for your application.

 

Step 2: Configure User Management

 

Navigate to the Authentication tab on your Supabase dashboard. Here, ensure that email signups are enabled, which allows users to register using their email addresses. Verify the SMTP settings so that Supabase can send out confirmation emails. You'll need to provide:

  • SMTP Host
  • SMTP Port
  • SMTP Username
  • SMTP Password
  • Email sender name and address

This setup allows Supabase to send confirmation emails using the configured SMTP server.

 

Step 3: Create a Function to Resend Confirmation Email

 

You'll need to interact with Supabase using its JavaScript client to trigger the resend. Install the Supabase library in your project if you haven't already:

npm install @supabase/supabase-js

Next, you need to set up your client:


import { createClient } from '@supabase/supabase-js'

// These keys can be found on the project's settings page
const supabaseUrl = 'https://your-supabase-url.supabase.co'
const supabaseAnonKey = 'your-anon-key'

// Create a Supabase client
const supabase = createClient(supabaseUrl, supabaseAnonKey)

 

Step 4: Implement the Resend Confirmation Functionality

 

Define a function within your application to handle the process of resending the email confirmation. This function will call the appropriate Supabase function to trigger the email resend:


async function resendConfirmation(email) {
  try {
    const { error } = await supabase.auth.api.resendEmailConfirmation(email)
    if (error) throw error
    console.log('Confirmation email resent successfully.')
  } catch (error) {
    console.error('Error resending confirmation email:', error.message)
  }
}

 

Step 5: Create a User Interface for Users to Request Resend

 

Develop a simple UI to allow users to request that a confirmation email be resent to their email address. Here’s an example using plain HTML and JavaScript:





  Resend Confirmation Email


  

Resend Confirmation Email

 

Step 6: Test the Resend Functionality

 

To ensure everything is correctly configured, test the application by trying to resend a confirmation email to a user. Check whether the email arrives in your designated inbox. If the email doesn’t arrive, verify the SMTP settings and ensure that there aren’t any connection issues with the SMTP server.

 

Step 7: Deploy Your Application

 

Once you've tested locally, deploy your web application to a hosting service of your choice (e.g., Vercel, Netlify, etc.). Be sure to handle environment variables securely, especially your Supabase URL and Anon key.

This guide provides a thorough walkthrough of the process to resend a confirmation email in Supabase, focusing on using their JavaScript library to automate this action efficiently.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022