DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How I Built an Email Validator That Detects Disposable Domains, Role Addresses, and Providers

You can validate most emails without sending them. Here's my 4-layer approach.

Layer 1: Format

RFC 5322 regex catches obvious invalids.

Layer 2: MX Records

const mx = await dns.resolveMx(domain);
if (mx.length === 0) // undeliverable
Enter fullscreen mode Exit fullscreen mode

Layer 3: Provider Detection

MX records reveal the provider:

  • aspmx.l.google.com → Google Workspace
  • *.protection.outlook.com → Microsoft 365

Layer 4: Disposable Check

Blocklist of 25+ domains: mailinator.com, guerrillamail.com, yopmail.com...

Bonus: Role Address Detection

admin@, info@, support@ are role-based, not personal. Important for sales.

Result

{"verdict": "VALID", "provider": "Google Workspace", "isDisposable": false}
Enter fullscreen mode Exit fullscreen mode

Free Email Validator on Apify — search knotless_cadence email-validator.

Top comments (0)