Skip to content

This repository contains a Node.js utility for detecting disposable email addresses. It helps identify whether an email address belongs to a disposable email provider, aiding in the prevention of spam and unwanted sign-ups.

License

Notifications You must be signed in to change notification settings

IntegerAlex/disposable-email-detector

Repository files navigation

Disposable Email Detector

CodeScene Code Health DeepScan grade workflow OpenSSF Best Practices DeepSource

NPM Downloads NPM Version

Overview

The disposable-email-detector is a TypeScript utility designed to identify disposable email addresses, providing developers with a tool to enhance email verification processes.

Features

  • Domain Check: Identifies if an email address belongs to a known disposable email domain.
  • Error Handling: Offers informative messages for scenarios like missing index.json or invalid JSON format.
  • Async File Reading: Utilizes asynchronous file reading for improved performance.

Getting Started

Prerequisites

  • Node.js
  • npm

Implementation Details

    npm i disposable-email-detector
    import  disposableEmailDetector  from 'disposable-email-detector';

    const email = 'test@mailinator.com';

    disposableEmailDetector(email)
        .then((response) => console.log(response)); //  true 

The disposableEmailDetector function reads a list of disposable email domains from index.json. It checks whether the provided email address belongs to a disposable domain and returns a boolean indicating the result.

Error Handling

  • If index.json is not found, the script informs you to create it with disposable domains.
  • If index.json has an invalid JSON format, it prompts you to correct the file.
  • Unexpected errors are logged to the console.

About

This repository contains a Node.js utility for detecting disposable email addresses. It helps identify whether an email address belongs to a disposable email provider, aiding in the prevention of spam and unwanted sign-ups.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published