INTEGRATIONS · BACKENDS AND HOSTING
Fix Supabase auth emails that never arrive
Supabase's built-in email is for testing: it sends only a few auth emails an hour, so sign-up confirmations and password resets stop arriving once real users show up. Point Supabase's Send Email Hook at MailKaka and those emails go out from your own domain.
- 3,000 emails a month free
- Billed in INR
- Sent from Mumbai
- User signs upin your app
- Supabase AuthSend Email Hook
- MailKakafrom auth@acme.in
- Inboxyour user gets the email
Confirm your email
From Acme <hello@acme.in>
HOW IT WORKS
Live in three steps.
- 01
Verify your domain
Add the DNS records MailKaka shows you. Usually a few minutes.
- 02
Create an API key
Keep it in a server-side secret called MAILKAKA_API_KEY.
- 03
Send with one request
A single HTTPS call from Supabase. No SMTP to set up.
CODE
Send Supabase auth emails through MailKaka
This edge function receives each auth email from Supabase, checks the hook signature, and sends it through MailKaka. It takes about ten minutes.
- 1Create a free MailKaka account. The free plan includes 3,000 emails a month.
- 2Add your domain in the dashboard and copy the DNS records it shows, including the _mailkaka-verify TXT record, to your DNS provider. Sending works once the domain shows Verified.
- 3Create an API key for that domain. It starts with mk_. Store it as a secret called MAILKAKA_API_KEY, never in frontend code.
- 4In Supabase, open Authentication → Hooks, add a Send Email hook of type HTTPS, and generate a secret. Copy it (it starts with v1,whsec_).
- 5Save both secrets and deploy the function below with the commands under it.
- 6Paste the function's URL into the hook and save. Sign up with a test address to check it works.
import { Webhook } from "https://esm.sh/standardwebhooks@1.0.0";
const hookSecret = Deno.env.get("SEND_EMAIL_HOOK_SECRET")!.replace("v1,whsec_", "");
const apiKey = Deno.env.get("MAILKAKA_API_KEY")!;
const FROM = "Acme <auth@yourdomain.com>";
const SUBJECTS: Record<string, string> = {
signup: "Confirm your email",
recovery: "Reset your password",
magiclink: "Your sign-in link",
invite: "You've been invited",
email_change: "Confirm your new email",
reauthentication: "Your confirmation code",
};
Deno.serve(async (req) => {
const payload = await req.text();
const headers = Object.fromEntries(req.headers);
try {
const { user, email_data } = new Webhook(hookSecret).verify(payload, headers) as {
user: { email: string };
email_data: { token: string; token_hash: string; redirect_to: string; email_action_type: string };
};
const link =
Deno.env.get("SUPABASE_URL") +
"/auth/v1/verify?token=" + email_data.token_hash +
"&type=" + email_data.email_action_type +
"&redirect_to=" + encodeURIComponent(email_data.redirect_to);
const res = await fetch("https://www.mailkaka.in/api/emails", {
method: "POST",
headers: { Authorization: "Bearer " + apiKey, "Content-Type": "application/json" },
body: JSON.stringify({
from: FROM,
to: [user.email],
subject: SUBJECTS[email_data.email_action_type] ?? "Your sign-in link",
html:
'<p><a href="' + link + '">Continue</a></p>' +
"<p>Or enter this code: <strong>" + email_data.token + "</strong></p>",
}),
});
if (!res.ok) throw new Error(await res.text());
} catch (error) {
return new Response(
JSON.stringify({ error: { http_code: 500, message: String(error) } }),
{ status: 500, headers: { "Content-Type": "application/json" } },
);
}
return new Response(JSON.stringify({}), { status: 200, headers: { "Content-Type": "application/json" } });
});supabase secrets set MAILKAKA_API_KEY=mk_xxxxxxxx SEND_EMAIL_HOOK_SECRET='v1,whsec_xxxxxxxx'
supabase functions deploy send-email --no-verify-jwtDeno.serve(async (req) => {
const { to } = await req.json();
const res = await fetch("https://www.mailkaka.in/api/emails", {
method: "POST",
headers: {
Authorization: "Bearer " + Deno.env.get("MAILKAKA_API_KEY"),
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "Acme <hello@yourdomain.com>",
to: [to],
subject: "Welcome to Acme",
html: "<p>Thanks for signing up.</p>",
}),
});
if (!res.ok) throw new Error(await res.text());
const { id } = await res.json();
return Response.json({ id });
});- --no-verify-jwt is needed because Supabase Auth calls the hook with its own signature, not a user JWT. The function checks that signature itself.
- If you change your email address with secure email change on, Supabase sends two tokens (token_new and token_hash_new). Extend the function if you use that flow.
- If Supabase still limits how many emails go out, raise the limit under Authentication → Rate Limits to fit your MailKaka plan.
WHAT YOU CAN SEND
Every email your app needs.
Welcome emails
Greet every new sign-up from your own address.
OTPs and password resets
Sign-in codes and reset links that arrive fast.
Orders and receipts
Confirmations, invoices and shipping updates.
Replies that reach you
Customer replies land in a shared team mailbox.
SIDE BY SIDE
Supabase's built-in email vs MailKaka
| Topic | Supabase built-in | MailKaka |
|---|---|---|
| Meant for | Trying things out during development | Real users in production |
| Sending limit | A few auth emails an hour | Your plan's monthly quota, from 3,000 free |
| From address | A Supabase address | Your own domain |
| Email design | Templates in the dashboard | Your own HTML, in code |
| Delivery status | Auth logs only | Every email, with delivered and bounced status |
| Billing | Part of your Supabase plan | INR, through Razorpay |
TROUBLESHOOTING
If something doesn't work.
Sign-up fails with an error after adding the hook
Open the function's logs in Supabase. A 401 from MailKaka means the API key secret is wrong; a signature error means SEND_EMAIL_HOOK_SECRET doesn't match the hook's secret.
The function returns 401 before running
It was deployed without --no-verify-jwt. Deploy it again with that flag; the function checks Supabase's hook signature itself.
The link in the email says it has expired or is invalid
Make sure redirect_to is one of the URLs allowed under Authentication → URL Configuration, and that users open the newest email.
BUILT FOR AI AGENTS
Let Claude Code, Cursor or any MCP client run your email.
MailKaka hosts an MCP server. Connect your coding agent once, and it can add your domain and show the DNS records, check verification, send a test email, read delivery status, and create the API key your app needs. You sign in from a browser and choose what it's allowed to do.
- Per-agent limits: 60 sends a minute and 500 emails a day
- Separate permissions for viewing, changing, sending and mailboxes
- A preview before deletes, batch sends and new API keys
- Every connection listed, and removable, in the dashboard
claude mcp add --transport http mailkaka https://www.mailkaka.in/api/mcpFAQ
Common questions.
Why are my Supabase auth emails not sending?
Supabase's default email service is only for testing and sends a very small number of auth emails per hour, and only to team members on some projects. Real apps need their own email provider. Routing the Send Email Hook through MailKaka removes that dependency.
Why use the Send Email Hook instead of custom SMTP?
MailKaka sends over its HTTP API, which logs every email in your dashboard and applies your plan's limits. The hook also lets you write your own email HTML in code instead of Supabase's template editor.
Does this work for Lovable and Bolt apps?
Yes. Lovable Cloud and Bolt projects built on Supabase use the same auth system. If you can't reach the Supabase dashboard, ask the builder to create the edge function and set up the hook for you.
Is MailKaka a good email API for Indian startups?
It's built for them. Email is sent from Mumbai, plans are priced and billed in INR through Razorpay (UPI and cards), and the free plan covers 3,000 emails a month. It accepts the same send request as Resend, so moving later is easy either way.
START WITH ONE DOMAIN
Send your first email from Supabase today.
Free for 3,000 emails a month. Paid plans are billed in INR through Razorpay.
RELATED