Blogs
Jun 5, 2024
We discuss and implement 3 solutions for including email notifications in your Supabase project using NodeJS.
While Supabase has a built-in email functionality, it can only be used to send authentication emails - and only 4 per hour. These heavy limitations require users to find and implement alternative email solutions. There are several 3rd-party solutions to this issue - we will cover 3 of them using NodeJS.
The 3 ways we cover are:
SendGrid: Email Only, 2-3 hours, 3k free emails
Resend: Email Only, 1 hour, 3k free emails
NotificationAPI: Multi-Channel, 5 minutes, 10k free emails
SendGrid
SendGrid is an email-oriented solution for sending notifications to users. Its features are beneficial for both marketing and transactional emails, allowing you to make the most of your emails. SendGrid also includes a template editor for designing your emails.
If you’re looking for more than just emails for your project’s notifications, you will need to integrate additional 3rd-party services to include those channels, as SendGrid is strictly for emails.
After creating an account with SendGrid Twilio, you’ll need to complete their onboarding requirements, such as:
Creating a sender identity
Having either a domain or email address you wish to use to send emails
Make sure to select the Web API option during their onboarding when asked which method you will use to send emails.
SendGrid’s onboarding does a good job of preparing you to send your first email, but here is some sample code:
Resend
Resend supports Supabase integration via their dashboard, allowing you to handle authentication emails without building your own. This also lets you bypass Supabase’s 4 emails per hour restriction. To do this, you will need to create a custom SMTP server.
This solution requires you to have your own domain in order to send emails, along with a more extensive setup, which will take the longest of our solutions to integrate. If you already have a domain, all of this can be done through Resend's dashboard via Settings:
Authorize Resend to access your Supabase API
Configure SMTP via Resend’s integration settings
Confirm your SMTP integration
Resend provides great documentation on sending emails, but we’ve included an example as well:
NotificationAPI
NotificationAPI is an all-in-one notification service, allowing you to expand to more than just emails without integrating more 3rd-party services. We let you skip steps such as creating a sender identity and preparing a custom SMTP for your domain, letting you get your email system up and running faster. We also support a multi-template editor for designing emails and any other notification you need.
All you need to do upon signing up is create a notification ID, which we cover during onboarding. Once that’s complete you can try implementing this sample code: