How to email all your Supabase users (the right way)

Guide4 min read

At some point every Supabase developer hits the same moment: you have real users, you want to reach them, and there's no obvious clean way to do it. You could export a CSV from the Supabase dashboard, import it into Mailchimp, configure a sending domain, set up a template, and send. That works. It's also about two hours of work you'll repeat every time you want to send, with a list that's already stale by the time you import it.

There are three common approaches. Here's what each one actually involves and where each one breaks.

Option 1: CSV export and Mailchimp

Supabase Auth users live in the auth.users table, which the Table Editor hides by default. The quickest route is the SQL Editor: run a query, then download the result as CSV.

sql
select email,
       raw_user_meta_data->>'full_name' as name,
       created_at
from auth.users
where email_confirmed_at is not null;

From there you create an audience in Mailchimp, map the columns, verify your sending domain, build a template, and send.

Where it breaks

  • The list is stale the moment you import it. Anyone who signs up after the export is missing next time unless you export again.
  • Two sources of truth. A user who deletes their account still exists in Mailchimp. A user who unsubscribes in Mailchimp is still opted in as far as your database knows.
  • Your data leaves your infrastructure. Every export is a copy of personal data in a third-party system you now have to account for under GDPR.
  • Filtering means re-exporting. Want only paid users? New query, new export, new import, then dedupe.

It's fine for a one-off send to fifty beta users. It isn't a process.

Option 2: Query Supabase and call Resend yourself

The developer instinct is to skip the middleman. You already have the data and an API key. The script is twenty lines.

ts
import { createClient } from '@supabase/supabase-js'
import { Resend } from 'resend'

const supabase = createClient(
  process.env.SUPABASE_URL!,
  process.env.SUPABASE_SERVICE_ROLE_KEY!
)
const resend = new Resend(process.env.RESEND_API_KEY)

const { data } = await supabase.auth.admin.listUsers({ perPage: 1000 })

for (const user of data.users) {
  await resend.emails.send({
    from: 'Dana <dana@yourapp.com>',
    to: user.email!,
    subject: 'Dark mode is live',
    html: '<p>Hi there, dark mode just shipped.</p>',
  })
}

It works the first time. Then the edge cases arrive one by one.

Where it breaks

  • Pagination. listUsers returns 50 users per page unless you ask for more, and 1,000 at most. Past that you need a loop, plus a way to resume when the script dies halfway through.
  • Rate limits. Resend caps requests per second. A tight loop starts returning 429 errors, and every failure is an email someone silently didn't get.
  • No unsubscribe. Gmail and Yahoo require bulk senders to support one-click unsubscribe through the List-Unsubscribe header. That means an endpoint, a token per user, and somewhere to store the opt-out.
  • No bounce handling. Hard bounces should stop future sends to that address. That's a webhook handler, a suppression table, and a check before every send.
  • No record of what happened. Who got the email? Who didn't, because the script crashed at user 412?

Each fix is small. Together they're a product: a queue, a suppression list, webhook handlers, an unsubscribe page, and a send log. You become the infrastructure, and it's infrastructure nobody on your team wanted to own.

Option 3: Read from the database at send time

The cleaner model keeps your Supabase database as the only source of truth and resolves recipients at the moment you press send.

  • Always current. Recipients are queried when the campaign runs, so the user who signed up five minutes ago is included and the one who deleted their account isn't.
  • Nothing to sync. There's no second copy of your users to keep in step.
  • Compliance by default. Unsubscribes and hard bounces land in a suppression list that's checked on every send.
  • Filters are just columns. "Paid users who signed up this year" is a condition on data you already have, not a new export.

This is the model BroadcastMail is built around. It connects via Supabase OAuth, reads your user table at send time through a dedicated read-only role, and delivers through your own Resend account, so the sender reputation stays yours.

The three side by side

CSV + MailchimpDIY scriptRead at send time
SetupAbout 2 hours, every sendAn hour, then ongoingAbout 5 minutes, once
List freshnessStale after importCurrentCurrent
UnsubscribesOnly inside MailchimpYou build itAutomatic
Bounce suppressionOnly inside MailchimpYou build itAutomatic
Filter by any columnRe-exportEdit the queryNo code
User data copied elsewhereYesNoNo

Set it up

If you want the third option without building it, the 5-minute quickstart covers connecting Supabase, adding your Resend key, and sending your first campaign.

Email your Supabase users today

Connect your project and send your first campaign in about five minutes. Free up to 500 recipients a month.

Start free

Keep reading