{
  "id": 16681443,
  "title": "Email validation with disposable detection, blocklists and allowlists in TypeScript",
  "url": "https://urgent.news/2026/10/27/email-validation-with-disposable-detection-blocklists-and-allowlists",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-27T00:25:01.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/riviergrullon/email-validation-with-disposable-detection-blocklists-and-allowlists-in-typescript-1php"
  },
  "original_language": "en",
  "account": "Validating an email address in a TypeScript application can be enhanced by incorporating disposable detection, blocklists, and allowlists. The mailrules library simplifies these decisions into a single, configurable API. To get started, install the library via npm and import the createEmailValidator function. Create a validator instance and specify any blocklists or allowlists based on your application's requirements. For example, you can block specific domains like spam.example or abuse@example.com, or allow only certain domains like trusted@mailinator.com. The validator checks the email format, looks for matches in the blocklist, checks for an allowlist exception if in only mode, and finally checks for disposable domains without an exception. The validation process is synchronous, making no network requests, and relies on data from the disposable-email-domains project. You can create your own validator instance using the core entry to manage your disposable domain data, though you'll need to supply and update this data yourself. The validator returns a stable reason code indicating the outcome, which can guide the application's feedback to the user. Remember, a valid result doesn't confirm mailbox existence or ownership, and it doesn't perform DNS, MX, or SMTP checks. Exact mailbox rules treat User@example.com and user@example.com as different. The library is compatible with ESM, CommonJS, Node.js 22.12+ and modern browser bundlers. Consider the rule precedence and API design, especially if you need to handle exceptions to disposable-email blocking.",
  "summary": "An email can have valid syntax and still fail your application's signup rules. You might want to reject disposable providers, block a specific mailbox, or accept only addresses from a company's domain. I built mailrules to bring those decisions into one configurable TypeScript/JavaScript API. Version 0.1.0 is available on npm . Start with a reusable validator npm install mailrules import {…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}