Dev.to
7/24/2026

How to Check SPF, DKIM, and DMARC Records in Python
Short summary
A practical Python tutorial for querying SPF, DKIM, and DMARC DNS records using dnspython, with code snippets for each record type and a combined audit function. Covers the SPF 10-lookup limit, DMARC policy levels, and the DKIM selector discovery problem. Ends with a brief pitch for the author's Bulko email tools.
- •SPF, DKIM, and DMARC are the three DNS records that determine email deliverability
- •Python code using dnspython to query and validate each record type
- •Common pitfalls: SPF lookup limit, DMARC p=none, unknown DKIM selectors
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



