DEV Community

Siftwright
Siftwright

Posted on

Clean a signup list in bulk: MX checks, disposable domains and typo suggestions in Python

Bad addresses in a signup list cost you bounces, sender reputation and wasted sends. Most checks you can run without sending a single email: syntax, whether the domain has MX records, whether it is a disposable provider, and whether it looks like a typo of a common domain. This tutorial runs those checks in bulk with the Bulk Email Validator Actor on Apify.

What it checks

  • Syntax and domain split
  • MX lookup (does the domain accept mail at all)
  • Disposable-provider detection
  • Role addresses (info@, admin@), free providers, plus-tags
  • Typo suggestions (gmial.com -> gmail.com)

It does not do SMTP mailbox probing, so a "deliverable" verdict means the domain can receive mail, not that the specific mailbox exists. Pricing is pay-per-event, $0.0008 per email, and it only charges for emails it actually returns.

Run it from Python

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("siftwright/email-validator-mx-disposable").call(run_input={
    "emails": ["jane@github.com", "test@mailinator.com", "someone@gmial.com"],
    "checkMx": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["email"], item["verdict"], item["reason"], item["suggestion"])
Enter fullscreen mode Exit fullscreen mode

Real output

This is the actual result of a test run with those three addresses (3 emails returned, 3 charged):

email verdict reason note
jane@github.com deliverable - MX: github-com.mail.protection.outlook.com
test@mailinator.com risky disposable has MX, but a throwaway provider
someone@gmial.com risky possible_typo suggestion: someone@gmail.com, no MX

Cleaning a list

Keep deliverable, drop or review risky, and discard anything invalid:

clean = [i["email"] for i in items if i["verdict"] == "deliverable"]
review = [(i["email"], i["reason"], i["suggestion"]) for i in items if i["verdict"] == "risky"]
Enter fullscreen mode Exit fullscreen mode

The typo suggestions are useful for signup forms: show "Did you mean someone@gmail.com?" instead of silently accepting a bad address.

Limits

No SMTP mailbox verification, so catch-all domains and non-existent mailboxes on valid domains pass the MX check. Use it as a cheap first filter before sending, not as a guarantee.

Actor: https://apify.com/siftwright/email-validator-mx-disposable

Top comments (0)