Skip to content

Custom SMTP for Supabase

Supabase's built-in email only reaches your own team, 2 messages an hour. Add Mektup as custom SMTP and your sign-up confirmations, magic links and password resets go out from your own domain, signed with DKIM, with a real mailbox behind the address.

Updated

1. Create the sending mailbox

In Mektup, add your domain and its DNS records, then create a mailbox such as auth@yourapp.com. Keep the password it shows: that is the SMTP password.

2. Add it to Supabase

In the Supabase dashboard open Authentication, then Emails, then SMTP Settings, turn on custom SMTP and enter:

Sender email     auth@yourapp.com
Sender name      Your App
Host             mail.usemektup.com
Port number      465
Username         auth@yourapp.com
Password         the mailbox password from Mektup

Then raise the limit under Authentication, Rate Limits: custom SMTP starts at 30 emails an hour.

3. Email from your own code

For emails outside Auth, such as receipts or notifications, call the Mektup API from an edge function. Store the key as a secret, never in the browser:

supabase secrets set MEKTUP_API_KEY=mek_live_...
supabase/functions/send-email/index.ts
// supabase/functions/send-email/index.ts
Deno.serve(async (req) => {
  const { to, subject, text } = await req.json();
  const res = await fetch("https://api.usemektup.com/v1/emails", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${Deno.env.get("MEKTUP_API_KEY")}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ from: "hello@yourapp.com", to, subject, text }),
  });
  return new Response(await res.text(), { status: res.status, headers: { "Content-Type": "application/json" } });
});

Receiving mail in Supabase

Set a Mektup mailbox webhook to another edge function, and every email to, say, support@yourapp.com arrives in your function as JSON, ready to write to a table. The webhook format and signature check.

Questions

Why does Supabase need custom SMTP?

Supabase's built-in email service is for testing: it only sends to members of your project's team, and its rate limit is 2 messages an hour. Real users need sign-up confirmations, magic links and password resets from your own SMTP server.

Which port should I use?

465 (implicit TLS) or 587 (STARTTLS) on mail.usemektup.com. Both work with Supabase.

Why am I limited to 30 emails an hour after setting up SMTP?

Supabase starts every project on custom SMTP at 30 messages an hour. Raise it in the dashboard under Authentication, Rate Limits. Mektup Starter allows 300 an hour and 2,000 a day.

Can users reply to the auth emails?

Yes. Because auth@yourapp.com is a real Mektup mailbox, replies land in it, where you can read them in webmail or forward them to support.

Start today, or talk to us?

Starter is $20 a month. Agencies get a quote for every client domain on one account.