Disclosure: I built the Apify Actor used in the second half of this post and earn money when people run it. The free script in the first half works on its own.

Since 2024, Gmail and Yahoo require bulk senders to publish SPF, DKIM and a DMARC record, and Microsoft's Outlook.com added the same rule for high-volume senders in 2025. If you send for more than one domain (an agency, a SaaS that sends on behalf of customers, a newsletter with a few brands), the question is simple: which of my domains are missing a record, or have one that doesn't protect anything?

Checking one domain by hand is easy with any online lookup. Checking 40 is tedious. This post does it for a list.

What to look for

Record Where it lives Problem worth flagging
SPF TXT record on example.com starting v=spf1 Missing; two SPF records (both fail); +all (anyone may send as you)
DMARC TXT record on _dmarc.example.com starting v=DMARC1 Missing; p=none (reports only, spoofed mail still delivered)
DKIM TXT record on <selector>._domainkey.example.com Can't be fully checked from outside: selectors are free-form names

p=none is the right first step while you read DMARC reports. It becomes a problem when a domain stays there for years.

Free option first: DNS over HTTPS, standard library only

No packages needed. Google's public DNS-over-HTTPS endpoint answers TXT lookups as JSON:

import json import urllib.parse import urllib.request def txt_records(name): url = "https://dns.google/resolve?" + urllib.parse.urlencode({"name": name, "type": "TXT"}) with urllib.request.urlopen(url, timeout=10) as r: data = json.load(r) return ["".join(part.strip('"') for part in a["data"].split('" "')) for a in data.get("Answer", []) if a.get("type") == 16] def check(domain): spf = [t for t in txt_records(domain) if t.lower().startswith("v=spf1")] dmarc = [t for t in txt_records("_dmarc." + domain) if t.lower().startswith("v=dmarc1")] issues = [] if not spf: issues.append("no SPF") elif len(spf) > 1: issues.append("two SPF records") elif spf[0].rstrip().endswith("+all"): issues.append("SPF +all") if not dmarc: issues.append("no DMARC") else: tags = dict(p.strip().split("=", 1) for p in dmarc[0].split(";") if "=" in p) if tags.get("p", "").strip().lower() == "none": issues.append("DMARC p=none") return issues for d in ["apify.com", "python.org", "example.com", "badssl.com"]: print(f"{d:15}", ", ".join(check(d)) or "ok") 

What it printed for me on 13 November 2026:

apify.com ok python.org DMARC p=none example.com ok badssl.com no SPF, no DMARC 

example.com sends no mail at all, and it says so properly: v=spf1 -all and a p=reject DMARC policy, which tells receivers to reject anything claiming to come from it. badssl.com (a public test site) has neither record, so anyone could send mail that claims to be from it. If a domain of yours doesn't send email, publish those two records anyway.

Where this script stops: subdomains with no DMARC record of their own inherit the parent's policy (it would wrongly say "no DMARC"), SPF has a 10-DNS-lookup limit that needs recursive resolving, and a mail-less domain needs no SPF include: at all. Those are fixable, but that's where 30 lines turn into 300.

The hosted version

I built those cases into an Apify Actor that checks a list of domains in one run. Along with SPF and DMARC it reports the mail provider, DKIM keys under common selectors, plus domain and SSL certificate expiry, and gives each domain an ok / warning / critical status. It costs $0.002 per domain (about $2 per 1,000), and a free Apify account includes $5 of usage a month.

You can run it from the web form with no code: paste the domains, click Start, export CSV. Or from Python:

pip install apify-client export APIFY_TOKEN=your_token_here # Apify Console > Settings > API & Integrations 
import csv import os from apify_client import ApifyClient domains = ["apify.com", "docs.python.org", "expired.badssl.com"] client = ApifyClient(os.environ["APIFY_TOKEN"]) run = client.actor("zahidthani/domain-health-checker").call( run_input={"domains": domains, "checkRegistration": False, "checkSsl": False}, max_total_charge_usd=0.05, ) # apify-client 3.x returns a Run object; 1.x and 2.x return a dict dataset_id = getattr(run, "default_dataset_id", None) or run["defaultDatasetId"] rows = [it for it in client.dataset(dataset_id).iterate_items() if it.get("type") == "domain"] cols = ["domain", "status", "mailProvider", "spf", "dmarcPolicy", "dmarcFrom", "dkimSelectors", "issues"] with open("email_auth.csv", "w", newline="") as f: w = csv.DictWriter(f, fieldnames=cols, extrasaction="ignore") w.writeheader() for r in rows: r = dict(r, issues="; ".join(r.get("issues") or []), dkimSelectors=", ".join(r.get("dkimSelectors") or [])) w.writerow(r) print(f"{r['domain']:20} {r['status']:8} {r['issues']}") 

Turning off the registration and SSL checks keeps the run to email DNS only (the price per domain is the same).

Example output

From a real run on 9 November 2026 with all checks on (trimmed):

domain status mailProvider dmarcPolicy issues
apify.com ok Google Workspace reject
docs.python.org warning none DMARC policy is p=none (monitoring only, spoofed mail isn't blocked)
expired.badssl.com critical SSL certificate problem: certificate has expired; No DMARC record

docs.python.org has no DMARC record of its own, so it's covered by python.org's, as receiving mail servers do. The dmarcFrom column says where the policy came from.

Tips

  • Check the domain in your From address, not your sending service's domain. Alignment is what DMARC checks.
  • Move from p=none to p=quarantine only after reading reports for a few weeks. Add rua=mailto:... to get them.
  • Don't flag a missing DKIM result as an error. Without knowing the selector your provider uses (google, selector1, k1...), nobody can prove DKIM is off from outside.
  • Re-check after DNS changes. Records are cached for their TTL, often an hour.

If you'd rather not run anything: the Actor's page is apify.com/zahidthani/domain-health-checker. Runnable Python, Node.js and n8n examples: https://github.com/zahidthani/apify-data-tools-examples

Questions about a specific record are welcome in the comments.