Open source · MIT · Zero dependencies

Audit SPF, DKIM, DMARC, BIMI and MTA-STS for any domain.

A small Node.js CLI that validates every email DNS authentication record — with recursive SPF lookup counting, automatic DKIM selector discovery and grading from A+ to F. Built by TrustYourWebsite as part of our compliance scanning suite.

Quick start

npx @trustyourwebsite/dns-auth-check example.com

Requires Node.js 18+. Want the full picture — security headers, cookies, GDPR consent, accessibility and more — across your entire site? Run a free scan at trustyourwebsite.com.

Sample output

DNS Email Authentication Report
================================
Domain:  example.com
Grade:   B (74/100)

SPF Record:
   Record found: v=spf1 include:_spf.google.com include:amazonses.com -all
   Hard fail (-all) configured
   DNS lookup count: 4/10
   Record length: 68 bytes

DKIM Records:
   Found 1 DKIM selector(s): google
   Record found at google._domainkey.example.com
  - Key type: RSA
   Key length: ~2048 bits

DMARC Record:
   Record found: v=DMARC1; p=none; rua=mailto:dmarc@example.com
   Policy is "none" — DMARC is monitoring only, not blocking spoofed emails
   Reporting URI (rua) configured: mailto:dmarc@example.com
   No subdomain policy (sp=) — subdomains inherit p=none

BIMI:
  - No BIMI record found (optional)

MTA-STS:
  - No MTA-STS record found (optional)

Issues (ordered by priority):
  1. [HIGH] DMARC policy is "none" — monitoring only, not blocking spoofed emails
     Fix: Change p=none to p=quarantine or p=reject after reviewing DMARC reports
  2. [LOW] No subdomain DMARC policy (sp=) — subdomains inherit p=none
     Fix: Add sp=reject to your DMARC record to protect subdomains
  3. [INFO] No BIMI record — consider adding one for brand visibility in inboxes

Full website compliance scan → https://trustyourwebsite.com

Zero runtime deps

Only Node's built-in node:dns and node:https. Security tooling should have minimal attack surface.

DKIM auto-discovery

Probes 18 common selectors out of the box — Google, Microsoft 365, SendGrid, Resend, Mandrill, Proton, Zoho and more — or specify your own.

Real SPF lookup counting

Doesn't just check that SPF exists. Recursively counts DNS lookups against the RFC 7208 limit of 10, flags +all, deprecated ptr and overly permissive ranges.

What we check

ProtocolWhat we validate
SPFRecord present, syntax, lookup count vs RFC 7208 limit, all qualifier, length, deprecated mechanisms
DKIMAuto-probes 18 selectors, key type (RSA / Ed25519), key length, revoked-key detection
DMARCPolicy strength, subdomain policy, rua/ruf reporting URIs, percentage, alignment modes
BIMIRecord at default._bimi, logo URL, VMC (Verified Mark Certificate)
MTA-STSTXT record and policy file fetch with mode validation
MX (opt-in)Record listing with priority, hostname resolution, provider identification (30+ providers)

Grading

GradeScoreMeaning
A+95–100Excellent — all protocols properly configured
A85–94Good — minor improvements possible
B70–84Fair — some important issues to fix
C55–69Poor — significant gaps in email auth
D40–54Bad — major security risks
F0–39Failing — email auth is essentially absent

Drop into CI

# GitHub Actions
- name: Check email DNS auth
  run: npx @trustyourwebsite/dns-auth-check yourdomain.com --ci

Exit code 1 when critical or high-severity issues are found.

Use as a library

import { auditDNSAuth } from '@trustyourwebsite/dns-auth-check';

const result = await auditDNSAuth('example.com', {
  dkimSelectors: ['google', 's1', 'default'],
  checkMX: true,
  timeout: 5000,
});

console.log(result.grade);            // 'A+' | 'A' | 'B' | 'C' | 'D' | 'F'
console.log(result.score);            // 0-100
console.log(result.spf.lookupCount);  // recursive DNS lookup count
console.log(result.dkim.selectors);   // per-selector results
console.log(result.dmarc.policy);     // 'none' | 'quarantine' | 'reject'

DNS auth is one piece of the compliance puzzle.

A real audit also covers HTTP security headers, cookie consent and GDPR, accessibility, TLS configuration and broken-link health — on every page of your site. TrustYourWebsite runs all of those automatically and gives you a single fix-it report.

Run a free scan at trustyourwebsite.com →

security-headers

Grade your website's HTTP security headers from A+ to F — HSTS, CSP, X-Frame-Options and more.

cookie-consent-validator

Verify cookie banners actually stop tracking when users click "Reject All".