Cover Image for How to Send Emails if You're Built on Supabase

How to Send Emails if You're Built on Supabase

9 min read
Ajay
Ajay

Building on Supabase gives you a rock-solid foundation: database, authentication, and APIs all in one place. But there's one critical piece that every app needs to nail: email 📨. Whether it's confirming new accounts, notifying users of important events, or sending weekly digests, email remains the backbone of user communication.

The challenge isn't whether you need email—it's choosing the right approach. You want a system that gets out of the way so you can focus on your product, but the landscape of options can feel overwhelming.

In this guide, we'll explore your options for sending emails when your backend runs on Supabase. We'll cover the types of emails apps typically send, what Supabase handles out of the box, and various approaches to implement the rest. Along the way, we'll share pragmatic solutions, including how tools like Notika can reduce friction. Let's dive in 🏊‍♂️.

The four types of emails

Before we talk implementation, let's map out the email landscape. Most apps send four distinct types of emails:

1. Authentication emails

These are the automated messages that handle account security and onboarding:

  • Signup confirmation ("Verify your email address")
  • Magic login links
  • Password reset requests
  • Email change verification

These emails are critical for user trust and security. The good news? 🎉 Supabase handles most of this infrastructure for you.

2. Transactional emails

Real-time notifications triggered by user actions or system events:

  • Order confirmations and receipts
  • Comment notifications ("Someone replied to your post")
  • System alerts and warnings
  • Status updates ("Your export is ready")

These are time-sensitive and directly tied to user activity.

3. Scheduled emails

Summary messages compiled and sent on either some cadence or delay after an event:

  • Daily or weekly content roundups
  • Monthly account summaries or digests
  • Usage reports
  • Reminder emails

4. Marketing & promotional emails

Messages not triggered by specific user actions, including one-off emails:

  • Welcome email series
  • Product announcements
  • Feature highlights
  • Special offers and promotions

These often require careful targeting and compliance (think: unsubscribe links).

Supabase's built in support

Supabase helps you with:

  • ✅ Authentication emails (with some configuration)

But you'll need to look elsewhere for:

  • ❌ Transactional emails
  • ❌ Scheduled/digest emails
  • ❌ Marketing & onboarding emails

Let's start with what Supabase gives you for free.

Supabase's auth email service

For authentication emails, you get convenient APIs that, when invoked, trigger the appropriate emails to be sent. These include emails for:

  • Confirm user
  • Invite user
  • Magic Link (for passwordless login)
  • Change Email Address
  • Reset Password

For instance, sending a magic link email is a single line of code:

typescript
const { data, error } = await supabase.auth.signInWithOtp({
  email: '[email protected]',
  options: {
    emailRedirectTo: 'https://your-app.com/welcome',
  },
})

Supabase handles funneling the right data to the email, and provides a default template for each email.

But there are important details to understand:

⚠️ Not for production

Supabase provides a default SMTP service so you can start immediately, but it's not for production:

  • Only delivers to authorized addresses (your team members)
  • Extremely low rate limits (2 emails/hour)
  • Comes from a shared email address (from supabase.io) vs your own custom email domain

To send auth emails to real users, you need to configure your own SMTP provider in the Supabase dashboard under Auth → Email Settings:

  1. Enable "Custom SMTP"
  2. Add your provider's credentials:
    • SMTP host and port
    • Username and password
    • From address

Popular SMTP providers that work great with Supabase include:

Once configured, all auth emails route through that provider, coming from your domain with proper deliverability.

Customizing templates

Next, you'll want to customize the templates for your auth emails:

  • Edit subject lines and body text
  • Add your logo and branding
  • Use template variables (user name, magic links, etc.)

You can do this by editing the templates in the Supabase dashboard under Auth → Email Templates. If you don't want to use Supabase's template editor, you can use Auth Hooks that let you intercept auth events and send custom emails via your own code. This way, for instance, you can send your auth emails through a custom provider (like Resend), and use that provider's email template development and management system.

This is definitely a more advanced use case, and requires additional setup. You need to setup your development environment, a deployment flow, and manage error handling.

Bottom line: Supabase handles the auth email infrastructure beautifully for your non-production environments. Going to production requires a bit more setup, but is definitely doable.

What about the rest?

Once your app goes live, you'll quickly need emails beyond authentication – purchase confirmations, comment notifications, daily summaries. Supabase doesn't have a built-in "email module" for these, so you'll need to choose an implementation approach.

Approach 1: Inline emails in your app logic

The most straightforward approach is sending emails directly from your application code when events occur. In your backend code, it might look like this:

typescript
// After saving a new comment, send notification
const comment = await saveCommentToDB(postId, authorId, content);

// Send notification email via API
await fetch("https://api.resend.com/emails", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${RESEND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    from: "[email protected]",
    to: postAuthor.email,
    subject: `New comment on "${post.title}"`,
    html: `<p>${comment.authorName} commented: "${content}"</p>`
  })
});

Pros:

  • Simple to understand and implement
  • Everything happens in one place
  • Direct control over timing

Cons:

  • Email logic scattered across your codebase
  • Changes require code deployments
  • Slow email APIs can delay user actions
  • Hard to maintain as you scale

This approach works fine for MVPs, but quickly becomes unwieldy as your app grows.

Approach 2: Queue-based email systems

This is how large companies like Google and Meta handle sending large volumes of emails in a scalable way. The codebase simply emits events to a queue, and a separate background process sends emails from that queue:

  1. When an event requires an email, append a job to a queue service like Kafka or SQS.
  2. A background worker listens for new events in the queue, and when it sees a new event, it sends an email.
  3. Failed emails can be retried automatically.

Advantages:

  • Handles provider outages gracefully
  • Built-in retry and rate limiting logic
  • Can batch emails for efficiency
  • Email sending is decoupled from app logic

Challenges:

  • Quite complex to implement, with significant infrastructure setup and monitoring needed
  • Requires queue monitoring
  • Overkill for most startups

You can use notification services like Knock.app, Courier, or CustomerIO to mitigate some of the complexity, but you still have the tight dependency between the codebase with the email sending logic, and these services can get pricey as you scale.

Approach 3: Event-driven emails via database webhooks

A great hybrid solution between the two approaches above is to use your database as the event source. When data changes, emails get triggered automatically based on that change.

For instance, if you have a comments table, you can configure a listener to trigger an email when a new comment is created.

This pattern shines when you have multiple events that trigger emails. Your app just writes to the database, and emails happen automatically in the background.

You could use either Supabase Database Webhooks, or a fully-managed solution like Notika.

Supabase Webhooks

Supabase offers Database Webhooks that call HTTP endpoints when rows change. Here's how it works:

  1. Configure a webhook on your comments table for INSERT events
  2. Point it to a Supabase Edge Function URL (or Vercel Function URL)
  3. The function receives the new comment data and sends the email
typescript
// Edge Function that receives webhook. Hosted at some url like https://your-app.com/api/webhooks/comments
export async function handler(req: Request) {
  const { record } = await req.json(); // New comment data
  
  // Fetch related data
  const { postAuthor, post } = await getPostDetails(record.post_id);
  
  // Send email
  await sendEmail({
    to: postAuthor.email,
    subject: `New comment on "${post.title}"`,
    // ... rest of email
  });
}

Benefits:

  • Decouples email sending from user actions
  • Database changes automatically trigger emails
  • Email delays don't affect user experience

Trade-offs:

  • Need to monitor webhook endpoints
  • Database based webhooks are not as reliable and push some load to your database
  • Requires some setup setup for each event and to manage different environments
  • No easy way to test the email sending logic

Using Notika

Notika is a fully-managed solution: after connecting your Supabase database, you can simply point to the table you'd like to trigger emails on, define your workflow in the visual editor, and Notika will handle the rest. No-code changes required.

Benefits:

  • No need to manage webhook endpoints
  • No need to manage different environments (just connect your production database to Notika)
  • Testing and simulation tools built-in
  • Use Notika's visual editor to build your email HTML
  • Scales with your app automatically- with built-in retry logic, monitoring, rate limiting, and more.

Trade-offs:

  • Requires one-time setup to connect Notika to your Supabase database.

Scheduled emails

For emails to your users that involve a temporal component, either in the form of a delay or a schedule, you'll need to setup some sort of recurring cron job.

Every time the cron job runs, it queries the database for users that meet the criteria for the email, then prepares and sends messages to each of those users.

Even if you use a notification service like Knock.app, Courier, or CustomerIO, you'll still need to host a cron job to fetch the data and emit events.

There are several ways to host a cron job, including:

  • GitHub Actions
  • Supabase cron
  • Vercel cron

The key challenge with these emails is managing the query and job complexity as your user base grows.

If you don't want to deal with all this complexity / additional infrastructure, you can use a service like Notika to setup "scheduled workflows" to kick off emails on a recurring basis against the latest data in your database.

Marketing email challenges

Marketing emails introduce a unique challenge: data synchronization.

Traditional email marketing tools (Mailchimp, Klaviyo, etc.) are powerful but create a fundamental problem: your user data lives in Supabase, but the email tool needs its own copy. This leads to:

  • Manual CSV exports and imports
  • Complex API integrations to sync users
  • Out-of-sync subscriber lists
  • Accidental emails to deleted accounts

Here's a typical onboarding flow with an external tool:

  1. User signs up (data in Supabase)
  2. Webhook or script sends user to email service
  3. Email service manages the drip campaign
  4. Hope the two systems stay in sync

Every sync point is a potential failure. You might email users who've already churned or miss new signups entirely.

A unified approach with Notika

This is where Notika offers a compelling alternative. Instead of juggling multiple email systems and sync scripts, Notika connects directly to your Supabase database and uses it as the single source of truth.

How Notika simplifies workflows

Database-driven everything
Notika watches your Postgres data changes in real-time. New order? Trigger an email. User hasn't logged in for 30 days? Send a re-engagement campaign. Everything flows from your database- no webhooks to maintain, no cron jobs to monitor.

One tool for all email types
Instead of using different services for different email types:

  • Transactional emails triggered by database events
  • Scheduled digests based on data queries
  • Multi-step onboarding sequences
  • Targeted campaigns using live database filters

All managed through visual workflows, not scattered code.

Zero sync required
Since Notika reads directly from your database, there's no data to export or sync. Want to email all users on the free plan? Create a workflow with that condition. The query runs against live data, so it's always accurate.

Built for everyone
Notika handles the infrastructure headaches:

  • Automatic retries on failures
  • Email delivery monitoring
  • Testing and simulation tools
  • No glue code to maintain

Your developers can rest easy and focus on core product, while fully offloading notifications to your non-technical product, growth, or marketing folks.

Making the right choice

Email infrastructure is one of those necessary evils in app development. Supabase gives you a great head start with auth emails, but you'll need a strategy for everything else.

For early-stage apps and MVPs, inline email sending might be perfectly adequate. As you grow, event-driven patterns provide a better separation of concerns (and Notika can help make easy as 🥧).

But here's the thing: unless email infrastructure is your core competency, you probably have better things to build. Tools like Notika exist to abstract away the complexity while giving you the control you need.

The best email system is the one that:

  • Lets you ship features instead of maintaining infrastructure
  • Scales with your app without major rewrites
  • Keeps your data in one place (your database)
  • Provides reliability without complexity

Whether you build it yourself or use a tool like Notika, the goal is the same: reliable, timely emails that enhance your user experience without consuming your engineering resources.

Happy building, and may your emails always reach the inbox!


Want to see how Notika can simplify your Supabase email workflows? Check out our documentation or try it free.