🔧 Unbreak My AppAll fixesError codesFix KitsSponsor

Fixes › Auth

App emails (sign-up, password reset, receipts) land in spam: fix SPF, DKIM and DMARC

LovableBoltCursorReplitv0

Published

The error

Confirmation, magic link, password reset or receipt emails go to the Spam/Junk folder, show 'via' or 'Be careful with this message' in Gmail, or bounce with '550 5.7.26 Unauthenticated email' / 'This message does not pass authentication checks'

Why it happens

Mailbox providers decide where your email goes mostly by checking who is allowed to send for your domain. SPF is a DNS record listing which servers may send for the domain, DKIM is a signature your email provider adds that's checked against a public key in your DNS, and DMARC is a record that tells receivers what to do when those checks fail and requires the domain in your From address to match (align with) the domain SPF or DKIM passed for. Vibe-coded apps often send from a provider like Resend, SendGrid, Postmark or AWS SES without finishing domain verification, use a From address on a domain they haven't verified (or a free @gmail.com address, which a third-party server can never authenticate), have two separate SPF records so SPF breaks entirely, or have no DMARC record at all. Since February 2024 Gmail and Yahoo require SPF or DKIM from every sender, and SPF, DKIM, DMARC and one-click unsubscribe for marketing mail from bulk senders, so unauthenticated app mail is filtered or rejected. Spammy content, link shorteners and brand-new domains with no sending history make it worse.

How to fix it

  1. Find out what's failing first: send a test email to a Gmail address, open it, and choose More (three dots) → Show original. It lists SPF, DKIM and DMARC as PASS or FAIL and which domain each passed for.
  2. Send from your own domain, ideally a subdomain such as mail.yourdomain.com or notifications.yourdomain.com, never from a @gmail.com or other free mailbox address. A subdomain keeps app mail's reputation separate from your normal inbox.
  3. Verify that domain in your email provider (Resend, Postmark, SendGrid, AWS SES and so on) and add every DNS record it shows you exactly as given: the DKIM records (TXT or CNAME) and the SPF / return-path records. Wait until the dashboard says Verified.
  4. Keep exactly one SPF TXT record per host name. If you already have one (for example for Google Workspace), add the new provider's include: to it rather than creating a second v=spf1 record, and stay under SPF's limit of 10 DNS lookups.
  5. Add a DMARC record: a TXT record on _dmarc.yourdomain.com with a value like v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com. Start with p=none to collect reports, then move to p=quarantine once you're sure all your legitimate mail passes.
  6. Make sure the From domain matches the domain DKIM signed for (or the SPF return-path domain), otherwise DMARC fails even though SPF and DKIM pass on their own.
  7. Separate transactional email (receipts, password resets) from newsletters, add a working one-click unsubscribe to marketing mail, and avoid link shorteners and image-only emails. If you use Supabase Auth, point its custom SMTP settings at the verified domain.
  8. Re-test with Show original, and if you send a lot to Gmail, watch your domain's reputation and spam rate in Google Postmaster Tools (Google asks bulk senders to stay below 0.3%).

Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)

Emails from my app (<WHICH EMAILS, e.g. sign-up confirmation, password reset, receipts>) are landing in spam or bouncing. We send with <PROVIDER, e.g. Resend / SendGrid / Postmark / AWS SES / Supabase SMTP> from the address <FROM ADDRESS>. Here is the 'Show original' authentication result from Gmail: <PASTE SPF / DKIM / DMARC lines>. Here are my current DNS TXT and CNAME records for the domain: <PASTE>. Tell me exactly which DNS records to add, edit or delete so SPF, DKIM and DMARC all pass and align with my From domain (one SPF record only, with the right include for my provider, and a starter DMARC record with p=none). Then check the code: make sure every email is sent from one configured From address on the verified domain (read it from an env var, never a @gmail.com address), that marketing emails include a working List-Unsubscribe header and link, and that transactional and marketing emails use separate senders. Don't print or commit any API keys.

Error codes this fixes

FAQ

Do I need all three: SPF, DKIM and DMARC?

Yes, in practice. Gmail and Yahoo require SPF or DKIM from everyone and all three for bulk senders, and DMARC is what makes the other two count for your From address.

Can I send from my @gmail.com address through Resend or SendGrid?

No. You can't add DNS records to gmail.com, so the mail fails DMARC and is likely to be filtered or rejected. Use a domain you own.

Everything shows PASS but it still goes to spam.

Authentication is only the entry ticket. A new domain with no history, high complaint rates, spammy wording or link shorteners can still land in spam. Send steadily, only to people who asked for it, and check Google Postmaster Tools.

Should I set DMARC to p=reject straight away?

No. Start with p=none and read the reports so you don't block your own legitimate mail (for example from Google Workspace or a billing tool), then tighten it.

Is this why my Supabase confirmation emails never arrive?

Possibly, but first check you're not still on Supabase's built-in test SMTP, which only sends to your team and a few emails per hour. See the related fix on Supabase auth emails not sending.

Sources

Based on the official documentation:

Related fixes

Want the full checklist for this area? Get a Fix Kit ($29)

Get one new fix a week

Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.

We only use your email to send the newsletter. Unsubscribe any time. See privacy.