DEV Community

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

Posted on

I Validate Emails Without Sending Them — Here Is How

Email validation doesn't require sending a test email. Here's what you can check programmatically:

1. Format Validation

Regex check for RFC 5322 compliance. Catches obvious typos.

2. MX Record Lookup

import dns from "dns/promises";
const records = await dns.resolveMx("stripe.com");
// [{priority: 1, exchange: "aspmx.l.google.com"}, ...]
Enter fullscreen mode Exit fullscreen mode

If no MX records exist, the email is undeliverable.

3. Provider Detection

From MX records, detect the email provider:

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

4. Disposable Domain Detection

Maintain a list of known disposable domains (mailinator.com, guerrillamail.com, etc.). Flag these emails.

5. Role Address Detection

Addresses like admin@, info@, support@ are role-based — usually not individual people. Important for sales outreach.

Combining Everything

My Email Validator tool on Apify outputs:

{
  "email": "user@stripe.com",
  "isValidFormat": true,
  "hasMxRecords": true,
  "provider": "Google Workspace",
  "isDisposable": false,
  "isRoleAddress": false,
  "verdict": "VALID"
}
Enter fullscreen mode Exit fullscreen mode

Free on Apify Store — search knotless_cadence email-validator.

Top comments (0)