npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

disposable-check

v0.2.0

Published

Detect disposable email addresses and domains. Zero dependencies, runs on Node, edge and browsers.

Readme

disposable-check

Detect disposable email addresses (mailinator.com, 10minutemail.com and about 10,000 others) in Node, edge runtimes and browsers. Zero dependencies, synchronous, typed.

import { isDisposableEmail } from "disposable-check";

isDisposableEmail("[email protected]"); // true
isDisposableEmail("[email protected]"); // true, subdomains count
isDisposableEmail("[email protected]"); // false

What it does, and what it doesn't

A disposable domain belongs to a service that hands out temporary addresses without sign-up. This library answers one question: is this email's domain (or one of its parents) on a list of disposable domains?

It deliberately does not:

  • flag free providers such as gmail.com or outlook.com,
  • flag role accounts such as admin@ or noreply@,
  • catch typos such as gmial.com,
  • validate email syntax against RFC 5322. Use your schema validator for that.

Install

npm install disposable-check

The package is ESM-only. It needs Node 22.12 or later, which can require() it as well as import it. The core has no runtime-specific code (only standard JavaScript and URL), so it also works on edge runtimes such as Cloudflare Workers and Vercel Edge, on Deno and Bun, and in browsers. CI tests it on Node.

Usage

Yes or no

import { isDisposableDomain, isDisposableEmail } from "disposable-check";

isDisposableEmail("[email protected]"); // true
isDisposableDomain("mailinator.com"); // true

Both return false for input they can't read as an email or a domain. Use checkEmail / checkDomain when you need to tell "not disposable" apart from "invalid".

The detailed answer

import { checkDomain, checkEmail } from "disposable-check";

checkEmail("[email protected]");
// {
//   verdict: "disposable",
//   domain: "inbox.mailinator.com",
//   matchedRule: { domain: "mailinator.com", source: "built-in" }
// }

checkEmail("[email protected]");
// { verdict: "not-listed", domain: "gmail.com", matchedRule: null }

checkEmail("not-an-email");
// { verdict: "invalid", domain: null, matchedRule: null }

CheckResult has this shape:

interface CheckResult {
  verdict: "disposable" | "allowed" | "not-listed" | "invalid";
  domain: string | null; // the canonical domain evaluated, null when invalid
  matchedRule: { domain: string; source: RuleSource } | null;
}

type RuleSource = "built-in" | "custom-block" | "custom-allow";

These types are exported, along with Verdict, MatchedRule, Checker and CheckerOptions. disposable-check/dns exports MxStatus, MxRecord, MxResolver and CheckMxOptions.

| verdict | Meaning | | ------------ | ---------------------------------------------------------------------------- | | disposable | The matched rule comes from the built-in blocklist or your custom blocklist. | | allowed | The matched rule comes from your custom allowlist. | | not-listed | No rule matches. | | invalid | The input can't be read as an email or a domain. |

matchedRule.source tells you whether a rejection came from the built-in blocklist or from your own rules. That's the first thing you'll want to know when someone reports a false positive.

Your own rules

import { createChecker } from "disposable-check";

const checker = createChecker({
  allow: ["corp.mailinator.com"], // never disposable
  block: ["evil.example.com"], // disposable, on top of the built-in blocklist
});

checker.checkEmail("[email protected]").verdict; // "allowed"
checker.checkEmail("[email protected]").verdict; // "disposable" (built-in)
checker.checkDomain("mx.evil.example.com").verdict; // "disposable" (custom-block)

A checker has the same four functions as the package: isDisposableEmail, isDisposableDomain, checkEmail and checkDomain. It's immutable, holds no global state and is cheap to create, so it's safe to share across requests. The top-level functions are those of a checker with no custom rules.

How rules match. A rule is a domain, and it matches that domain and every subdomain of it. When several rules match, the most specific one (the longest domain) decides, whatever list it comes from. If an allow rule and a block rule name exactly the same domain, allow wins. That's how both examples above work: corp.mailinator.com is more specific than the built-in mailinator.com, and evil.example.com would be more specific than an allowed example.com.

Invalid rules throw. Rules are read like any input, so " München.DE. " works. A rule that isn't a domain throws a TypeError naming it when you create the checker. That's a bug in your code, not bad user input. Wildcards aren't needed, because a rule already covers its subdomains:

createChecker({ block: ["*.example.com"] });
// TypeError: Invalid block rule "*.example.com": expected a domain such as "example.com". Drop the wildcard: "example.com" already covers its subdomains.

A rule needs at least two labels, so "com" is rejected.

How input is read

  • Surrounding whitespace is trimmed and letters are lowercased.
  • An email's domain is everything after the last @. The local part is ignored, and an empty local part makes the email invalid.
  • One trailing dot is dropped (mailinator.com.).
  • Internationalized domains are converted to punycode (münchen.de becomes xn--mnchen-3ya.de). The conversion uses the runtime's built-in URL, so very old browsers may differ on unusual inputs.
  • IP addresses, single-label names (localhost), URLs, ports, paths, wildcards and labels outside letters, digits and inner hyphens are invalid.
  • Input longer than 1,000 characters is invalid without being parsed. The longest valid address is 254 characters.

Nothing in the core throws for any input: a value that isn't a string is invalid.

MX check (Node only)

A separate entry point looks up whether a domain accepts mail. It's async and uses node:dns, so it isn't part of the core and never reaches your browser bundle.

import { checkMx } from "disposable-check/dns";

await checkMx("[email protected]"); // "has-mx"
await checkMx("example.com"); // "no-mx" (it publishes a Null MX)
await checkMx("x.com", { timeoutMs: 2000 }); // "unknown" if DNS doesn't answer in time

| MX status | Meaning | | --------- | ------------------------------------------------------------------------------------------------------------------------- | | has-mx | At least one real MX record. | | no-mx | The domain doesn't exist, has no MX records, or publishes a Null MX (RFC 7505). | | unknown | The lookup failed or timed out, or the input isn't an email or a domain. |

checkMx never rejects. It doesn't fall back to A records. It's independent of the disposable verdict: many disposable domains do receive mail, which is how they work. Combine the two answers however your app needs.

Options:

  • timeoutMs (default 5000, at most 2147483647): gives up with unknown. A query on the system resolver is also cancelled, so it doesn't keep the process alive.
  • resolveMx(domain, { signal }): your own lookup, returning Promise<{ exchange, priority }[]>. Use it for custom DNS servers, caching, or tests. signal is an AbortSignal aborted once checkMx stops waiting, so pass it to fetch (for example with DNS over HTTPS) to cancel the lookup on timeout.

Where to run it

Check addresses on the server: in an API route, a server action or a form handler. A check in the browser is easy to skip, and it adds the built-in blocklist to your client bundle. The core also works in edge functions and middleware. disposable-check/dns needs a Node.js runtime.

// For example, a Next.js server action
"use server";
import { isDisposableEmail } from "disposable-check";

export async function signUp(formData: FormData) {
  const email = String(formData.get("email") ?? "");
  if (isDisposableEmail(email)) {
    return { error: "Please use a permanent email address." };
  }
  // ...
}

If you use createChecker, create the checker once at module level and reuse it.

Bundle size and runtimes

The core is about 58 KB minified and gzipped, nearly all of it the built-in blocklist, which is parsed on first use. It uses only standard JavaScript and URL. CI checks that the core never imports a Node built-in and that it stays under 70 KB.

Where the list comes from

The built-in blocklist is a snapshot of the community-maintained disposable-email-domains list, dedicated to the public domain under CC0 1.0. Thanks to its maintainers. Each release embeds the list at a fixed upstream commit, recorded at the top of the generated file. Nothing is downloaded at runtime. A weekly job compares the list with upstream and, when domains were added or removed, opens a pull request that releases a patch version once merged.

The upstream maintainers don't guarantee that every listed domain is still disposable. If one causes a false positive for you, add it to your custom allowlist (allow). Report wrongly listed domains upstream, not here.

Versioning. The API follows semver. Updates to the built-in blocklist ship as patch releases, because they change data rather than the API. Pin an exact version if you need the list frozen.

License

MIT. The built-in blocklist is CC0 1.0.