no-disposable-email
Version:
A fast, reliable tool to check if an email address uses a disposable domain. Includes an Express API, CLI, and utility function. Perfect for validation in web apps, and scripts.
182 lines (128 loc) • 4.21 kB
Markdown
# no-disposable-email
[](https://github.com/yassirh/no-disposable-email/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/no-disposable-email)

[](https://hub.docker.com/r/yassirh/no-disposable-email)
A fast, reliable tool to check if an email address uses a disposable domain. Includes an Express API, CLI, and utility function. Perfect for validation in web apps, and scripts.
## Table of Contents
- [Features](#features)
- [Demo](@demo)
- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [CLI](#cli)
- [Utility Function](#utility-function)
- [Docker](#docker)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)
## Features
- 🚀 Express API: `/check?email=...` endpoint
- 🛠️ CLI: `npx no-disposable-email <email>`
- 🧩 Utility: `isDisposable(email)`
- 🐳 Docker support
- ⚡ Domains are regularly updated from https://github.com/disposable-email-domains/disposable-email-domains/blob/main/disposable_email_blocklist.conf
## Demo
Try it online 
:
[Is Disposable Email API](https://uptimeobserver.com/api/free-tools/is-disposable-email?email=foo@mailinator.com) or
[Is Disposable Email GUI](https://uptimeobserver.com/free-tools/disposable-email-checker/)
## Installation
### NPM (CLI & Utility)
```sh
npm install no-disposable-email
```
### Clone & Run Locally
```sh
git clone https://github.com/yassirh/no-disposable-email.git
cd no-disposable-email
npm install
```
## Usage
### API
Start the server:
```sh
node index.js
```
Check an email:
```sh
curl 'http://localhost:3000/check?email=foo@mailinator.com'
```
Response:
```json
{
"email": "foo@mailinator.com",
"disposable": true
}
```
### CLI
```sh
npx no-disposable-email foo@mailinator.com
# or if installed globally
no-disposable-email foo@mailinator.com
```
### Utility Function
```js
const { isDisposable } = require('no-disposable-email');
console.log(isDisposable('foo@mailinator.com')); // true or false
```
### Heartbeat Endpoint
A simple health check endpoint is available:
```sh
GET /heartbeat
```
Response:
```json
{
"status": "ok"
}
```
You can use this to verify the service is running (e.g., for Docker health checks or uptime monitoring).
## Docker
### Running with Docker
To run the service using Docker:
Start the container, mapping port 3000 inside the container to port 3000 on your host:
```sh
docker run -d -p 3000:3000 yassirh/no-disposable-email
```
The API will be available at: [http://localhost:3000/check?email=foo@mailinator.com](http://localhost:3000/check?email=foo@mailinator.com)
### Build and run with Docker:
```sh
docker build -t no-disposable-email .
docker run -p 3000:3000 no-disposable-email
```
### Multi-Architecture Image for Docker Hub
To build and push a multi-architecture image to Docker Hub:
```sh
docker buildx create --use
# Build for amd64 and arm64 v8
docker buildx build --platform linux/amd64,linux/arm64/v8 -t yassirh/no-disposable-email:latest --push .
```
## Updating the Blocklist
To update the list of disposable domains to the latest version from the official source, run:
```sh
npm run update-blocklist
```
This will download the latest `disposable_email_blocklist.conf` from the upstream repository.
## Development
- Add domains to `disposable_email_blocklist.conf` (one per line)
- Run tests:
```sh
npm test
```
## Contributing
Pull requests welcome! For major changes, open an issue first to discuss what you would like to change.
## License
You can copy, modify, distribute and use the work, even for commercial purposes, all without asking permission.
[](https://creativecommons.org/publicdomain/zero/1.0/)