Skip to content

About

+30,000 free and disposable email domains in a single list, validated against DNS every day.

Topics

Resources

Stars

297 stars

Watchers

5 watching

Forks

Repository files navigation

microlink logo microlink logo

free-email-domains

Last version NPM Status

Free and disposable email domains in a single list, validated against DNS every day.

Highlights

  • 30,000+ domains. Free providers (Gmail, Yahoo, Outlook and thousands of regional ones) and disposable providers (Mailinator, Temp Mail and the like) together.
  • Six sources plus a curated list. Merged, deduplicated and lowercased.
  • Validated against DNS. A domain is removed when its DNS records say it cannot receive email.
  • Updated every day. A new version is published whenever the list changes.
  • Zero dependencies. It is a JSON array of strings, with TypeScript types.

Why use it

  • Block temporary or throwaway inboxes during signup.
  • Tell personal emails from work emails to qualify leads.
  • Reduce fake form submissions.
  • Keep CRM and email workflows cleaner.

Install

$ npm install free-email-domains --save

Usage

The module exports an array of lowercase domains:

const freeEmailDomains = require('free-email-domains')

freeEmailDomains.includes('gmail.com') // => true
freeEmailDomains.includes('mailinator.com') // => true
freeEmailDomains.includes('your-company.com') // => false

It works the same with ES modules:

import freeEmailDomains from 'free-email-domains'

Checking an email address

Create a Set once to get constant time lookups, then compare the part after the last @ in lowercase:

const freeEmailDomains = new Set(require('free-email-domains'))

const isFreeEmail = email => {
  const domain = email.slice(email.lastIndexOf('@') + 1).toLowerCase()
  return freeEmailDomains.has(domain)
}

isFreeEmail('hello@gmail.com') // => true
isFreeEmail('Hello@Mailinator.com') // => true
isFreeEmail('hello@your-company.com') // => false

Domains are matched exactly: gmail.com is listed, mail.gmail.com is not.

Without Node.js

The list is a plain JSON file, so any language can use it:

$ curl -sL https://cdn.jsdelivr.net/npm/free-email-domains/domains.json

How the list is built

The list is rebuilt every day from these sources:

Then every domain coming from a source is checked against DNS, asking two public resolvers (Cloudflare and Google):

DNS answer Result
It has MX records kept
It has no MX records but it has an A or AAAA record (implicit MX) kept
It publishes a null MX removed
It does not exist, or it has no MX, A or AAAA record removed
Timeout or server failure unchanged from the previous scan

A domain is only removed when both resolvers agree it cannot receive email. Removed domains are stored at inactive-domains.json, and they come back on the first daily scan where a resolver finds them accepting email again.

The scan refuses to write anything when a resolver fails a sanity check (gmail.com must be active, a .invalid name must not exist), or when too many domains come back inactive or unanswered.

Curated domains are never removed by the scan. Domains listed by a source that are neither free nor disposable providers are excluded with the allowlist at scripts/sources.mjs.

Update data

Fetch the sources, scan DNS and write domains.json and inactive-domains.json:

$ npm run update

The scan takes about a minute. The postinstall script does the same without the DNS scan, reusing inactive-domains.json:

$ node scripts/postinstall.mjs

Contributing

Related

License

free-email-domains © Microlink, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

microlink.io · GitHub microlinkhq · X @microlinkhq

About

+30,000 free and disposable email domains in a single list, validated against DNS every day.

Topics

Resources

Stars

297 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages