All posts

Your app's emails land in spam: SPF, DKIM and DMARC explained

Sign-up confirmations that never arrive, password resets that sit in spam, receipts customers swear they did not get. When I check an app with this problem, the cause is almost never the app's code. It is how the email is sent and whether the receiving mailbox trusts it. Here is how to tell, and what to fix, in plain words.

First: is it really a deliverability problem?

Trigger the email yourself with a fresh Gmail or Outlook address, then check in this order:

  1. Spam and promotions folders. If it is there, the email was sent and accepted, but the mailbox does not trust you. That is a deliverability problem.
  2. The sending service's logs. Whatever your app uses to send (Supabase, Resend, Postmark, SendGrid, Amazon SES or similar) shows each message and its status: delivered, bounced, rejected. "Delivered" plus nothing in the inbox means spam placement. "Bounced" or an error means the provider refused it.
  3. No log entry at all. Then the app never asked to send it, and that is a bug, not a deliverability issue.

The default sender is for testing

Apps built with tools like Lovable or Bolt often start on the sending service that comes with the backend. Supabase's own docs say its built-in email server "is not meant for production use". When I read the page today it also said the limit is currently 2 messages per hour (and that this value can change), and that it only delivers to addresses belonging to your project's team members. Anyone else gets an "Email address not authorized" failure. There is no delivery guarantee either.

So if your sign-up emails work for you and your developer but not for real customers, this is the first thing to check. The fix is to connect your own sending service and send from your own domain, for example hello@yourcompany.com.

SPF, DKIM and DMARC in plain words

Email has no built-in proof of who sent it, so anyone can claim to be you. These three DNS records are how a mailbox like Gmail checks that a message really comes from you. They are text entries you add where your domain's DNS is managed.

  • SPF is a list of the servers allowed to send email for your domain. The receiving mailbox checks whether the sender is on the list.
  • DKIM is a digital signature added to every message. Your sending service signs it with a private key, and a public key in your DNS lets the mailbox verify it was not forged or changed on the way.
  • DMARC is your instruction for what to do when SPF and DKIM fail, plus a way to get reports back. It also requires that the domain in the visible "From" address matches the domain that passed SPF or DKIM.

Setting up your own sending domain

Every transactional provider has the same shape: you add your domain, it shows you DNS records, you paste them in at your domain registrar or DNS host, and it verifies them. Use the provider's own page for the exact records, because they differ:

  • Resend recommends sending from a subdomain (such as updates.yourcompany.com) to keep your sending reputation separate from your main domain. It also has a DMARC guide.
  • Postmark uses a DKIM record plus a custom Return-Path record, and has a verification guide.
  • Amazon SES sets up DKIM when you create a domain identity, and says DNS changes can take up to 72 hours to propagate.
  • SendGrid calls it domain authentication. It generates the DNS records for SPF, DKIM and DMARC, and removes the "via sendgrid.net" label.

Do not use the sending service's shared address as your "From". The point is that the mailbox sees your domain, authenticated, every time.

What Gmail and Yahoo require since 2024

Both started enforcing sender rules in February 2024. I read each page today. Google's Email sender guidelines:

  • Every sender must set up SPF or DKIM for the sending domain, have valid forward and reverse DNS records, use a TLS connection, and keep the spam rate reported in Postmaster Tools below 0.3%.
  • Bulk senders, defined by Google as more than 5,000 messages a day, must set up SPF and DKIM and also DMARC, and the "From" domain must align with the SPF or DKIM domain. The DMARC policy is allowed to be none. Marketing and subscribed messages must also support one-click unsubscribe.

Yahoo's sender best practices split the same way: all senders need SPF or DKIM at a minimum and a spam rate below 0.3%, and Yahoo strongly urges everyone to publish a DMARC policy. Bulk senders need both SPF and DKIM, a valid DMARC policy of at least p=none, and an unsubscribe header. I did not find a 5,000 figure on Yahoo's page, so check it for your volume.

A small app sending a few hundred emails a day is not a "bulk sender" on Google's definition. But I would still set up all three records. They are free, and mailboxes treat unauthenticated mail with suspicion whatever the volume.

Rolling out DMARC safely

A strict DMARC policy tells mailboxes to reject mail that fails the checks. If you switch that on before everything legitimate is authenticated, you can block your own emails. So go in steps:

  1. Publish a TXT record at _dmarc.yourcompany.com with v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.com. p=none changes nothing about delivery. It only asks for reports.
  2. Read the reports for a few weeks. They show who is sending as your domain: your app, your newsletter tool, your office email, and anything you forgot. Fix each legitimate sender so it passes.
  3. Move to p=quarantine (failing mail goes to spam). Once that has been quiet for a while, consider p=reject.

Raw report files are unreadable XML, so most people use a free report viewer from a provider or a DMARC monitoring service. I will not name one here because I have not compared them for this post.

Free checks

The 15-minute check

  1. Send yourself a sign-up email from a fresh Gmail address. Inbox, spam, or nothing?
  2. Open your sending service's log. Delivered, bounced or missing?
  3. Find out which service the app really uses to send. If it is the backend's built-in sender, plan to replace it.
  4. Check the "From" address uses your own domain, not the provider's.
  5. Run your domain through Check MX and confirm SPF is found.
  6. In the sending service, confirm the domain shows as verified, DKIM included.
  7. Look up your DMARC record. If there is none, publish p=none with a reporting address.
  8. In Gmail, use "Show original" on a received test email and check SPF, DKIM and DMARC all say PASS.
  9. Send one test through mail-tester.com and read what it flags.

Want this fixed on your app?

I check and fix email sending on apps built with Lovable, Bolt, Cursor or Base44: moving off the default sender, setting up the domain and DNS records, and testing every email the app sends, from sign-up to password reset. See also the launch-ready checklist, or send me the details on the hire page and I'll reply within 24 hours.