Dev.to Security 🔐 Cybersecurity 👁 0 📖 1 min read

Why do your emails hit spam? Check the headers you never look at — offline .eml audit

If you send transactional email — receipts, password resets, magic links — deliverability isn't a marketing problem, it's an engineering one. And the diagnostic data is sitting in the headers of every message you've ever

If you send transactional email — receipts, password resets, magic links — deliverability isn't a marketing problem, it's an engineering one. And the diagnostic data is sitting in the headers of every message you've ever received. Nobody looks at it.

I built a tool that reads any .eml file and produces a deliverability report, fully offline.

What email_audit.py checks

Drop in a received email (or raw headers) and it reports:

  • AUTH: parses Authentication-Results for SPF/DKIM/DMARC verdicts — fails and absent mechanisms are findings
  • HOPS: counts Received headers — a long chain means your mail is being relayed through infrastructure you don't control
  • RISK: missing List-Unsubscribe / bulk Precedence, X-Mailer leaks (hand-rolled scripts announcing themselves), HTML-only body, malformed Date, missing Message-ID
  • META: From/To/Subject/Date + Return-Path-vs-From domain mismatch
python3 tools/email_audit.py message.eml           # human report
python3 tools/email_audit.py message.eml --json    # pipeline
python3 tools/email_audit.py message.eml --strict  # any finding = exit 1

Verified against paired fixtures

examples/good.eml (pass auth, list-unsubscribe, bulk precedence) → clean, exit 0. examples/bad.eml (spf/dkim/dmarc fail, no unsubscribe, HTML-only, bad date, X-Mailer leak, Return-Path domain mismatch) → 9 findings, exit 1.

The honest limits

  • It reads headers as received — trusting the receiver's Authentication-Results rather than recomputing DNS itself (a dig-based companion is the right next tool, not this one).
  • It doesn't predict spam-folder placement — that's reputation, which lives at the receiver. This is a header-hygiene audit.
  • SRS/rewrite edge cases in Return-Path are noted but not penalized.

$10, stdlib only, works on any .eml you have:

https://wesleygitari2-cloud.github.io/nexus-store-redirect/p/email-header-audit

Last time an email of yours hit spam — did you check headers, or just resend?

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.