Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Email validation with disposable detection, blocklists and allowlists in TypeScript

Description and use

mailrules lets developers configure email validation rules, including disposable provider blocking, blocklists, allowlists, and domain restrictions, returning stable reason codes for each rejection.

Problem

An email can have valid syntax and still fail an application's signup rules, such as rejecting disposable providers, blocking specific mailboxes, or accepting only addresses from a company's domain.

Outcome

mailrules enables developers to enforce complex email validation policies without network requests, providing clear reason codes for each rejection and supporting custom disposable domain data.

Workflow

  • Install mailrules via npm
  • Create a validator with createEmailValidator and configure blocklist, allowlist, or disposableDomains
  • Reuse the validator instance for multiple checks
  • Call validator.check(email) to get a result object with valid and reasons
  • Use allowlistMode:'only' to restrict access to specific domains or addresses
  • Set includeSubdomains:false to require exact domain matches
  • Update dependencies or supply new data to refresh disposable domain lists

Evidence

I built mailrules to bring those decisions into one configurable TypeScript/JavaScript API.

Source

Create the validator once and reuse it. Lists are copied, normalized and indexed during construction. Validation is synchronous and makes no network requests.

Source

An explicit block always wins over an allowlist exception. The result includes a stable reason code so the application can decide what feedback to show.

Source

  • Record date: 2026-10-27T01:11:17.374Z