Anyone can send an email that says it comes from you@yourapp.com. Unless your domain says otherwise, mail systems have no way to tell the fake from the real one. Attackers use this to phish your users with messages that look like they came from your app. And if your own emails (receipts, sign-in links, password resets) land in spam, the same missing records are often the reason.
Why AI Builders Miss This
Three DNS records fix this: SPF, DKIM and DMARC. AI tools wire up the email sending code, but rarely mention them. Modern development workflows often focus exclusively on wiring up the email sending code. Tools like Resend, Postmark, SendGrid, or AWS SES provide the necessary DNS records, but developers frequently skip the critical step of actually adding them to their domainβs DNS zone. The result is a functional email system that fails basic authentication checks, leaving the door open for domain spoofing.
Who Is at Risk
Any app that sends email from its own domain is at risk. This includes sign-in links, receipts, notifications, and password resets. If you send from a custom domain through a service like Resend, Postmark, SendGrid or SES, the service gives you records to add, and it is easy to skip that step.
What Each Record Does
SPF is a DNS record that lists which servers may send mail for your domain. DKIM is a signature your sending service adds to each message, checked against a public key in your DNS. DMARC tells receiving servers what to do when SPF and DKIM fail (nothing, quarantine, or reject) and where to send reports.
The 5-Minute Diagnostic
To verify your setup, look up your domain's TXT records with a DNS lookup tool, or run dig TXT yourapp.com in a terminal. Find one that starts with v=spf1. If there is none, SPF is missing. If there is more than one, that is also a problem, since a domain should have exactly one. Next, look up _dmarc.yourapp.com. You want a record that starts with v=DMARC1. If it is missing, anyone can spoof you freely. Finally, check your sending service's dashboard to ensure the domain is verified for DKIM.
The Ultimate Test
Send a test email from your app to a Gmail address. Open "Show original" and look for SPF: PASS, DKIM: PASS and DMARC: PASS. If all three are in place and the test message shows PASS for each, your setup is secure. If not, you are exposed to spoofing attacks.
Remediation and Best Practices
If you find gaps, add the SPF and DKIM records your sending service gives you. Add a DMARC record starting with p=none and a reporting address so you can see who sends as you. Once your own mail passes, move to p=quarantine, then p=reject. Keep one SPF record, and merge services into it instead of adding a second. Use a separate subdomain for marketing mail if you can, so it does not affect app email.
Key Takeaways
- Check your DNS immediately using
dig TXT yourapp.comand look forv=spf1. - Ensure you have exactly one SPF record; merge services if you have duplicates.
- Verify DKIM status in your email providerβs dashboard, not just in your code.
- Start DMARC with
p=noneto gather reports before enforcing strict rejection policies. - Use a dedicated prompt for AI builders to list required DNS records and avoid changing existing entries without review.
The Bottom Line
Email authentication is not optional infrastructure; it is the baseline for trust. If you are building with AI agents, treat DNS verification as a mandatory deployment gate, not an afterthought.