Why your SPF record passes in the checker and still fails in real life

2026-12-05来源 dev.toEnglish

so a friend's invoices were landing in spam and he said "but i added the SPF record". he had. the record was there, i could see it. and it was still broken, so here is what i check now, in the order i check it.

first, count the records. you are allowed exactly one TXT record starting with v=spf1 on a domain. one. if you added a second one for your newsletter tool, that is two, and SPF is a permanent error for everyone. nobody gets a warning, the mail just starts looking suspicious. merge them into one line with both includes in it.

second, the 10 lookup limit, and this is the sneaky one. every include: costs a lookup, and then whatever is inside that included record costs more, all the way down. over 10 and the whole record is an error, even though it looks fine when you read it. so you cannot just eyeball it, you have to count across the whole tree. the cheap fix is to delete services you stopped using years ago, or swap an include for the ip4: ranges it stands for, those cost nothing.

third, +all or no all at the end. +all means anyone in the world can send as you. end it with ~all or -all, ~all is the usual one.

fourth, SPF passing does not mean DMARC passes. DMARC wants the domain in the From address to line up with the domain SPF checked, and a lot of email services send with their own return path. so SPF says pass and DMARC still fails. the fix is turning on DKIM signing with your own domain in that service's settings. and a lot of providers publish nothing until you click start authentication in their console, so check that too.

last one, DNS takes time. if you just added it and a checker says nothing there, wait for the TTL. also make sure it is a TXT record at the root and your DNS panel did not wrap it in extra quotes.

i got tired of doing this by hand so i built a checker for it, SPF, DKIM, DMARC, it follows the includes and counts the lookups. ya i'm biased, i built it. i also wrote the whole walkthrough, including how to move DMARC from p=none to reject slowly, here: https://theomnikit.com/guides/check-spf-and-dmarc?utm_source=devto&utm_medium=article&utm_campaign=devto-spf-passes-but-fails

what is the weirdest SPF thing you have run into? mine was a record with three includes for tools the company had stopped paying for two years back.

drafted this with some AI help, the facts are from the guide page.

原文:https://www.a8q9.cn/en/article/why-your-spf-record-passes-in-the-checker-and-still-fails-in-real-life-2be983.html

相关文章