Files
Anthropic-Cybersecurity-Skills/skills/implementing-dmarc-dkim-spf-email-security/references/api-reference.md
T
mukul975 c21af3347e Complete folder anatomy for all 649 cybersecurity skills + update LICENSE to Mahipal
- Add scripts/agent.py and references/api-reference.md to all remaining skills
- Update all 648 LICENSE files: copyright now reads 'Mahipal'
- Add implementing-security-monitoring-with-datadog (new skill with full anatomy)
- All 649 skills now have: SKILL.md, LICENSE, scripts/agent.py, references/api-reference.md
2026-03-11 00:22:12 +01:00

1.4 KiB

API Reference: Implementing DMARC/DKIM/SPF Email Security

dnspython Lookups

import dns.resolver
# SPF
answers = dns.resolver.resolve("example.com", "TXT")
# DMARC
answers = dns.resolver.resolve("_dmarc.example.com", "TXT")
# DKIM
answers = dns.resolver.resolve("selector._domainkey.example.com", "TXT")

SPF Record Syntax

Mechanism Example Meaning
include: include:_spf.google.com Authorize sender
ip4: ip4:203.0.113.0/24 Allow IP range
-all End of record Hard fail others
~all End of record Soft fail (weak)
+all End of record Allow all (insecure)

DMARC Policy Levels

Policy Action Severity if Missing
p=reject Reject failing mail Recommended
p=quarantine Send to spam Acceptable
p=none Monitor only HIGH risk
# SPF
v=spf1 include:_spf.google.com -all

# DMARC
v=DMARC1; p=reject; pct=100; rua=mailto:dmarc@example.com; adkim=s; aspf=s

# DKIM (provider-specific key)
selector._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIIBIjAN..."

References