Supabase auth email not sending in a Lovable app: the SMTP setup that actually works
By AI App Medic · Updated · Lovable · Supabase · Auth · Email
A familiar Lovable launch bug: you can sign up, the new row appears in Supabase, the app shows "check your email", and nothing arrives. Password reset and magic links may fail the same way, or one of them works while another does not. This is usually not a bug in the form Lovable generated. Auth emails are sent by Supabase Auth, through whatever SMTP you have configured on that project.
First, see what Supabase actually did
- Open Supabase > Authentication > Users and find the test user.
- Note
email_confirmed_atandconfirmation_sent_at(you can also inspect these in theauth.userstable). If the user is already confirmed and no mail was sent, "Confirm email" may be disabled under Authentication > Sign In / Providers > Email. - If the row was never created, the problem is the signup request itself (URL, anon key, or a failing profile trigger), not SMTP. If the response says
Database error saving new user, follow Database error saving new user first. - Check Authentication > Providers that Email is enabled, and that you are not requiring a feature (confirmations, magic links) you then disabled.
Also look at the redirect URLs. After the user clicks the link, they should land on your live app, not localhost. That is a separate fix, covered in login redirects to localhost after deploy, but a bad Site URL can make it look like "email never worked" when the mail arrived and the link was wrong.
Why it worked in testing
On a new Supabase project, auth mail goes out through a shared default sender. That sender is a development convenience. It has a low rate limit (on the order of a couple of messages per hour), it is not a production deliverability service, and in many setups it only reliably reaches members of the project. You tested with your own email, which is on the team, so the first real customer is the first real failure.
Supabase's own going-to-production guidance is to switch to a custom SMTP provider before you invite the public. Do that even if a few test messages arrived.
Step 1: turn on custom SMTP
Pick a transactional provider (Resend, Postmark, Amazon SES, and similar all work). Create a sender domain you control, such as mail.yourdomain.com or the root domain, and get SMTP credentials from the provider.
- In the Supabase dashboard open Project Settings or Authentication > SMTP Settings (the label moves occasionally; look for "Enable custom SMTP").
- Turn custom SMTP on and fill in the host, port, user, password, and the From address the provider verified. Use a From that matches the authenticated domain, for example
login@yourdomain.com, not a Gmail address. - Save, then do not immediately test with your team inbox only.
Connecting Resend (or another mail API) inside the Lovable project is useful for your emails: welcome messages, receipts, notifications. It does not replace this setting. Confirmation links, magic links, and password resets keep using Supabase Auth's mailer until custom SMTP is on.
Step 2: authenticate the domain so the mail is not junked
Even after SMTP is connected, messages can vanish into spam or be dropped, especially at Outlook and some school or workplace hosts. At your DNS provider, add the records the SMTP provider shows you:
- SPF on the sending domain, with the provider's
include:and only one SPF record per host. - DKIM as one or more TXT (or CNAME) records.
- DMARC, starting with a relaxed policy such as
p=noneso you can watch reports before you tighten it.
If the domain already has an SPF record for Google Workspace or Microsoft 365, edit that record to include the transactional provider. Do not add a second SPF record on the same host; receivers will treat it as a fail.
If the domain is also used for a Lovable custom domain, leave the MX records for your inbox provider alone. The mail-sending records and the website A or CNAME records can live side by side. See Lovable custom domain not working if the site itself is the thing that broke while you were editing DNS.
Step 3: fix the templates and the links
Supabase > Authentication > Email Templates lets you change the subject and body. Keep the {{ .ConfirmationURL }} (or the equivalent variable shown in the template) intact. If you replace the link with a path you invented, the token will not confirm the user.
Set Site URL to your production origin, and add every preview and custom domain to Redirect URLs. The confirmation link is built from those settings, not from whatever page the user was on when they typed their email.
Step 4: test like a stranger
- Use an inbox that is not listed as a Supabase team member, ideally a personal Gmail and one Outlook address.
- Sign up, then check the provider's dashboard: accepted, delivered, bounced, or delayed. If it never left the provider, the SMTP credentials or From domain are wrong. If it was delivered and you cannot see it, check spam and the domain's DNS.
- Click the link in a private window. Confirm the user row updates, and that you land on the production domain.
- Repeat for password reset and, if you use them, magic links. They are separate templates and can break on their own.
If confirmation mail stopped after you added SMTP, but magic links still work, go back to the Confirm email toggle and to the confirmation template. If every mail shows as sent in Supabase and never appears in the provider logs, the project is still on the default sender, or the SMTP password was saved wrong.
What not to do
- Do not disable email confirmation just to "make signups work" unless you are sure you want unverified accounts, and you have another way to prove the address.
- Do not send auth emails from the browser with a Resend API key. That key will leak, and you will fight CORS for no reason (see Edge Function CORS if you already went down that path).
- Do not paste SMTP passwords into the Lovable chat or a GitHub issue.
Once strangers receive the mail and the link opens your live app, this part of launch is done. You can then customize the template and add a separate welcome email from your own function, after the user is confirmed.
FAQ
Why did emails work for me but not for my first real user?
Supabase's default mailer is meant for development. It is rate limited, and messages to addresses that are not on your project team often never arrive. Your own tests used a team inbox, so they hid the problem.
I connected Resend in Lovable but auth emails still look like the default ones.
Signup confirmation, magic links, and password resets are sent by Supabase Auth, not by your app code. Connecting Resend in the app does not change those. Configure custom SMTP in the Supabase project's Authentication settings.
Magic links work but confirmation emails do not, or the user is confirmed instantly.
If email_confirmed_at is set at signup and confirmation_sent_at is empty, Confirm email is off and Supabase is auto-confirming. Turn the setting on if you want a confirmation mail, and check that your SMTP provider is not the only path that broke.
Related guides
- Supabase login redirects to localhost (or the preview URL) after deploy: how to fix it
- Lovable custom domain not working: fix DNS, SSL, and the sign-in redirect
- Lovable + Supabase Edge Function CORS error: why the browser says failed to fetch
- Supabase signUp fails with "Database error saving new user": fix the auth.users trigger
- Supabase "email rate limit exceeded" (429): why signup breaks after two emails and how to fix it