Dev.to WebDev πŸ›  Dev πŸ‘ 2 πŸ“– 2 min read

How to Verify B2B Email Deliverability (MX, SPF, DMARC & Domain Age) in 10 Lines of TypeScript

If you run a B2B SaaS signup flow, outbound sales pipeline, or CRM enrichment workflow, bad domains quietly burn your sender reputation and pollute your database. Before you ever send an email or pass a lead to sales, f

If you run a B2B SaaS signup flow, outbound sales pipeline, or CRM enrichment workflow, bad domains quietly burn your sender reputation and pollute your database.

Before you ever send an email or pass a lead to sales, four fast DNS and RDAP checks tell you almost everything you need to know about a domain:

  1. Can it actually receive email? (Live MX records + disposable domain filter)
  2. Which mail provider do they run? (Google Workspace, Microsoft 365, Proofpoint, Mimecast, Zoho, Proton, Cloudflare)
  3. How strict is their security posture? (SPF record presence + DMARC policy: none, quarantine, or reject)
  4. How old is the domain? (Live IANA RDAP registration date, registrar, and exact age in days to spot burner domains)

Check Any Domain or Email in 10 Lines of TypeScript

Instead of wrestling with raw DNS sockets and inconsistent WHOIS/RDAP servers, you can query a single serverless REST endpoint that runs all 6 lookups in parallel and returns a clean 0 to 100 deliverability score:

const RAPIDAPI_KEY = process.env.RAPIDAPI_KEY!;

async function checkDomainIntel(emailOrDomain: string) {
  const param = emailOrDomain.includes('@') ? 'email' : 'domain';
  const res = await fetch(
    `https://domain-rdap-dns-email-deliverability-intel-api.p.rapidapi.com/api/domain-intel?${param}=${encodeURIComponent(emailOrDomain)}`,
    {
      headers: {
        'x-rapidapi-key': RAPIDAPI_KEY,
        'x-rapidapi-host': 'domain-rdap-dns-email-deliverability-intel-api.p.rapidapi.com',
      },
    }
  );
  return res.json();
}

const intel = await checkDomainIntel('[email protected]');
console.log({
  score: intel.deliverability.score,
  provider: intel.deliverability.emailProvider,
  dmarcPolicy: intel.deliverability.dmarcPolicy,
  domainAgeDays: intel.registration?.domainAgeDays,
});

Bulk-Auditing Lead Lists & Connecting AI Agents

Try It Free Across All 4 Marketplaces

Need a custom B2B enrichment pipeline, private scraper, or n8n automation built for your team? Reach out on Contra: https://contra.com/julian_roberts_fvzgvg6y/work

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.