# Email Validation & Disposable Domain Detector (`riad_h/email-validation-disposable-detector`) Actor

Stop fake users and trial fraud! This ultra-fast API validates syntax, performs live MX record lookups, and flags disposable domains (like TempMail). Boost deliverability and protect signup forms from spam bots instantly. Try it free for blazing-fast verification!

- **URL**: https://apify.com/riad\_h/email-validation-disposable-detector.md
- **Developed by:** [Riad Hossain](https://apify.com/riad_h) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Email Validation & Disposable Domain Detector

> Fast, production-grade email validation with real-time MX record lookups, RFC 5322 syntax checks, and disposable / temporary email domain detection.

![Version](https://img.shields.io/badge/version-1.0.0-blue)
![Python](https://img.shields.io/badge/python-3.11+-green)
![Latency](https://img.shields.io/badge/p95_latency-<350ms-success)

***

### 🎯 What it does

This Actor validates email addresses using three layers of checks, returning a structured JSON result for each email:

| Layer | What it checks | Method |
|---|---|---|
| **Syntax** | RFC 5322 compliance | Regex + length rules |
| **DNS / MX** | Domain can receive email | Async DNS lookup against Cloudflare 1.1.1.1, Google 8.8.8.8, Quad9 9.9.9.9 |
| **Disposable** | Domain is a temporary / throwaway provider | Curated 636-domain blacklist + heuristic detection |
| **Typo** | Domain is a misspelling of a major provider | Levenshtein distance ≤ 2 against 20+ top providers |

### ✨ Features

- ✅ **RFC 5322 syntax validation** — catches malformed emails (`not-an-email`, `user@@example.com`, etc.)
- ✅ **Real MX record lookup** — async DNS, returns primary MX host, IP address, and priority
- ✅ **636-domain curated disposable blacklist** — Mailinator, TempMail, GuerrillaMail, 10MinuteMail, YOPmail, and 631 more
- ✅ **Heuristic detection** — catches disposable domains not in the blacklist via:
  - High-abuse TLDs (`.tk`, `.gq`, `.cf`, `.ml`)
  - Keyword matching (`temp`, `trash`, `throwaway`, `disposable`, `10minutemail`, ...)
  - MX-pattern recognition (custom domains pointing at disposable infrastructure)
  - High-entropy random subdomain detection (Shannon entropy)
- ✅ **Typo detection** — catches `user@hootmail.com` and suggests `user@hotmail.com`
- ✅ **Cache** — results cached for 24h (Redis primary, in-memory fallback)
- ✅ **Async & parallel** — validates 1,000 emails per run with bounded concurrency
- ✅ **Low latency** — p95 < 350ms (cache miss), < 5ms (cache hit)

### 📥 Input

The Actor accepts a JSON object with the following fields:

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `emails` | array of strings | ✅ | — | List of email addresses to validate (max 1,000 per run) |
| `check_mx` | boolean | ❌ | `true` | Set to `false` to skip MX lookups (syntax + disposable only, much faster) |
| `detect_disposable` | boolean | ❌ | `true` | Set to `false` to skip disposable detection |

#### Example input

```json
{
  "emails": [
    "alice@gmail.com",
    "spam@mailinator.com",
    "user@hootmail.com",
    "not-an-email",
    "bob@nonexistent-xyz-domain-12345.com"
  ],
  "check_mx": true,
  "detect_disposable": true
}
```

### 📤 Output

Each validated email is pushed to the default dataset as a separate item:

```json
{
  "email": "someone@mailinator.com",
  "valid": false,
  "disposable": true,
  "reason": "Blacklist",
  "domain": "mailinator.com",
  "syntax_valid": true,
  "mx_host": "mail.mailinator.com",
  "mx_ip": "23.239.11.30",
  "mx_info": "Using MX pointer mail.mailinator.com from DNS with priority: 10",
  "domain_typo_detected": false,
  "suggested_correction": null,
  "execution_time_ms": 142,
  "cache_hit": false
}
```

#### Field reference

| Field | Type | Description |
|---|---|---|
| `email` | string | The email address that was checked |
| `valid` | boolean | `true` if syntactically valid AND has MX/A records AND not disposable AND no typo |
| `disposable` | boolean | `true` if domain is a known or heuristic disposable provider |
| `reason` | string|null | `"Blacklist"`, `"MX Pattern"`, `"Heuristic"`, or `null` |
| `domain` | string|null | Lowercased domain part of the email |
| `syntax_valid` | boolean | `true` if RFC 5322 syntax is valid |
| `mx_host` | string|null | Primary MX hostname |
| `mx_ip` | string|null | IPv4 of primary MX host |
| `mx_info` | string|null | Human-readable MX resolution summary |
| `domain_typo_detected` | boolean | `true` if domain is a typo of a major provider |
| `suggested_correction` | string|null | Corrected email when typo detected |
| `execution_time_ms` | integer | Server-side processing time in ms |
| `cache_hit` | boolean | `true` if served from cache |

### 💡 Use cases

#### 1. Signup form validation

Block disposable emails at signup to prevent abuse and ensure deliverable onboarding emails.

#### 2. Lead list cleanup

Run a CSV of leads through this Actor before a marketing campaign. Filter out:

- Invalid syntax (will bounce)
- No MX records (will bounce)
- Disposable (will never convert)
- Typos (correct them and salvage the lead)

#### 3. Fraud detection

Flag accounts signing up with temp-mail providers for manual review.

#### 4. Email list hygiene

Periodically re-validate your subscriber list to remove addresses whose domains have lost MX records.

### 🔧 How it works

```
┌─────────────────────────────────────────────────────────┐
│                    Input (emails[])                       │
└─────────────────────────────┬───────────────────────────┘
                              │
                              ▼
              ┌───────────────────────────────┐
              │      OrchestratorAgent         │
              │  (cache lookup → fan-out)      │
              └───┬───────────────────────┬───┘
                  │                       │
                  ▼                       ▼
    ┌──────────────────────┐  ┌──────────────────────┐
    │ ValidationEngine     │  │  DisposableIntel     │
    │  - RFC 5322 syntax   │  │  - Blacklist match   │
    │  - Async DNS MX      │  │  - MX pattern        │
    │  - Typo detection    │  │  - Heuristics        │
    └─────────┬────────────┘  └──────────┬───────────┘
              │                          │
              └────────────┬─────────────┘
                           ▼
              ┌──────────────────────┐
              │  Push to dataset     │
              └──────────────────────┘
```

### 📊 Performance

| Path | p50 | p95 | Notes |
|---|---|---|---|
| Cache hit | 0–5 ms | < 10 ms | In-memory or Redis GET |
| Cache miss (valid email) | 50–150 ms | < 250 ms | Parallel DNS + blacklist |
| Cache miss (disposable) | 20–100 ms | < 200 ms | Blacklist short-circuits |
| 1,000 emails (bulk) | — | ~30 sec | Bounded concurrency (20) |

### 🧪 Tested

- 107 unit + integration + live DNS tests pass
- 96 real-world emails tested (Gmail, Yahoo, Outlook, iCloud, Proton, international providers, disposable providers, typos, invalid syntax)
- 50 concurrent requests: p95 = 170ms
- Zero correctness issues in extended testing

### 📚 Same logic as the RapidAPI version

This Actor shares its core engine with the [Email Validation & Disposable Domain Detector API on RapidAPI](https://rapidapi.com/). If you need a real-time HTTP API (vs. batch Apify runs), use the RapidAPI version. If you need to process thousands of emails in batch, use this Actor.

### 📝 License

MIT

# Actor input Schema

## `emails` (type: `array`):

List of email addresses to validate. Supports up to 1,000 per run.

## `check_mx` (type: `boolean`):

If true, performs live DNS MX lookups. Disable for fast syntax-only validation.

## `detect_disposable` (type: `boolean`):

If true, runs the disposable-domain blacklist + heuristic checks.

## Actor input object example

```json
{
  "emails": [
    "test@gmail.com",
    "spam@mailinator.com",
    "user@hootmail.com",
    "not-an-email"
  ],
  "check_mx": true,
  "detect_disposable": true
}
```

# Actor output Schema

## `results` (type: `string`):

All validated email results — valid, disposable, MX records, typos, and more.

## `run_details` (type: `string`):

Full run metadata including input, output, and logs.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "emails": [
        "test@gmail.com",
        "spam@mailinator.com",
        "user@hootmail.com",
        "not-an-email"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("riad_h/email-validation-disposable-detector").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "emails": [
        "test@gmail.com",
        "spam@mailinator.com",
        "user@hootmail.com",
        "not-an-email",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("riad_h/email-validation-disposable-detector").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "emails": [
    "test@gmail.com",
    "spam@mailinator.com",
    "user@hootmail.com",
    "not-an-email"
  ]
}' |
apify call riad_h/email-validation-disposable-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,riad_h/email-validation-disposable-detector"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Fgf1P9T8OcfdXwbeK/builds/2iAFcOWAB5qeh2zmI/openapi.json
