Disposable Email Validator: Block Disposable Emails and Plus Addressing

Disposable Email Validator: Block Disposable Emails and Plus Addressing

Summary

The `disposable-email-validator` library helps prevent fake signups by blocking disposable email addresses and optional plus addressing. It offers flexible, environment-specific rules, making it ideal for production applications while allowing development flexibility. This TypeScript-based tool provides a robust solution for email validation.

Repository Info

Updated on February 6, 2026
View on GitHub

Introduction

disposable-email-validator is a powerful TypeScript library designed to help applications block disposable email addresses and manage plus addressing with environment-specific rules. It's perfect for preventing fake signups in production environments while offering flexibility for development and testing. The library provides a robust, configurable solution to enhance the integrity of user registrations and communications.

Installation

Getting started with disposable-email-validator is straightforward. You can install it using npm:

npm install disposable-email-validator

Examples

Here's a quick example demonstrating how to configure and use the validator to block disposable emails in a production environment:

import { DisposableEmailValidator } from 'disposable-email-validator';

const config = {
  production: {
    rules: {
      allow_disposable_emails: false,
      allow_plus_addressing: false,
    }
  }
};

const validator = new DisposableEmailValidator('production', config);

const result = validator.validateEmail('user@10minutemail.com');
console.log(result);
// { success: false, error: 'Disposable email addresses are not allowed' }

The library supports highly flexible, environment-based configuration, allowing you to define different validation rules for development, staging, production, or any custom environment you create. You can also provide custom lists of disposable or trusted domains and control whether they merge with the built-in list.

Why Use This?

disposable-email-validator offers several compelling benefits for your applications:

  • Designed for production apps: Built with real-world scenarios in mind.
  • Prevent fake signups: Effectively blocks temporary emails that often lead to spam or fraudulent accounts.
  • Multiple environments supported: Easily adapt validation rules across different deployment stages.
  • Built-in domain blacklist: Comes with a comprehensive list of known throwaway providers out of the box.
  • Fast, typesafe, and extendable: Offers high performance, full TypeScript support, and easy customization.

Links