# email-validator

Adopt this skill: https://proskills.md/skills/other/alex-vbcoding-email-validator-skill

Page: https://proskills.md/skills/other/alex-vbcoding-email-validator-skill
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 2278
sha: 898ff4a06bc6af930fffbf204cc4af61443a78e0
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/SKILL.md

````text
---
name: email-validator
description: Validate email addresses with format checks, DNS MX verification, and typo detection. Returns validation results with suggestions for common typos.
homepage: https://github.com/alex-vbcoding/email-validator-skill
metadata: {"openclaw": {"emoji": "📧", "requires": {"bins": ["node"]}}}
---

# Email Validator Skill

Validate email addresses with comprehensive checks: format validation, DNS record verification, and common typo detection.

## Features

- ✅ RFC-compliant email format validation
- ✅ DNS MX record verification (checks if domain can receive email)
- ✅ Common typo detection (e.g., "gmial.com" → "gmail.com")
- ✅ Disposable email detection
- ✅ Batch validation support

## Installation

```bash
npm install email-validator-skill
```

## Usage

### Basic validation

```javascript
const { validateEmail } = require('email-validator-skill');

const result = await validateEmail('user@example.com');
console.log(result);
// {
//   valid: true,
//   email: 'user@example.com',
//   checks: {
//     format: true,
//     dns: true,
//     disposable: false
//   }
// }
```

### Check for typos

```javascript
const result = await validateEmail('user@gmial.com');
// {
//   valid: false,
//   suggestion: 'user@gmail.com',
//   typo: 'gmial.com' → 'gmail.com'
// }
```

### Batch validation

```javascript
const emails = ['valid@example.com', 'invalid@', 'typo@gmial.com'];
const results = await validateBatch(emails);
```

## API Reference

### `validateEmail(email, options)`

**Parameters:**
- `email` (string): Email address to validate
- `options` (object):
  - `checkDNS` (boolean): Verify DNS MX records (default: true)
  - `checkTypos` (boolean): Suggest typo corrections (default: true)
  - `timeout` (number): DNS timeout in ms (default: 5000)

**Returns:** Promise<ValidationResult>

### `validateBatch(emails, options)`

Validate multiple emails efficiently.

**Parameters:**
- `emails` (array): Array of email addresses
- `options` (object): Same as validateEmail

**Returns:** Promise<ValidationResult[]>

## Common Typos Detected

- gmial.com → gmail.com
- yahooo.com → yahoo.com
- hotmial.com → hotmail.com
- outlok.com → outlook.com

## License

MIT

## Author

Alex Chen (alex@metaleap.so)
````

## File: README.md
size: 466
sha: c636199b97ce1a1ef4c720737d7f81ca906bc4bb
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/README.md

````text
# Email Validator Skill

A production-ready OpenClaw skill for email validation.

## Quick Start

```bash
npm install email-validator-skill
```

```javascript
const { validateEmail } = require('email-validator-skill');

const result = await validateEmail('user@example.com');
console.log(result.valid); // true
```

## Documentation

See [SKILL.md](./SKILL.md) for complete API reference and examples.

## Testing

```bash
npm test
```

## License

MIT © Alex Chen
````

## File: .gitignore
size: 40
sha: e3b04b70624fc32809f66aa6cac7513771d2fa59
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/.gitignore

```text
node_modules/
*.log
.DS_Store
coverage/
```

## File: index.js
size: 2889
sha: 3dd703b1b9f16ae1efbfef7047c3d468286dd429
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/index.js

```text
const dns = require('dns').promises;

// Common email typos
const TYPO_MAP = {
  'gmial.com': 'gmail.com',
  'gmai.com': 'gmail.com',
  'yahooo.com': 'yahoo.com',
  'yaho.com': 'yahoo.com',
  'hotmial.com': 'hotmail.com',
  'outlok.com': 'outlook.com',
  'outloo.com': 'outlook.com'
};

// Disposable email domains
const DISPOSABLE_DOMAINS = [
  'tempmail.com',
  '10minutemail.com',
  'guerrillamail.com',
  'mailinator.com'
];

/**
 * Validate email format using RFC-compliant regex
 */
function validateFormat(email) {
  const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  return regex.test(email);
}

/**
 * Check if domain has MX records (can receive email)
 */
async function checkDNS(domain, timeout = 5000) {
  try {
    const records = await Promise.race([
      dns.resolveMx(domain),
      new Promise((_, reject) => 
        setTimeout(() => reject(new Error('DNS timeout')), timeout)
      )
    ]);
    return records && records.length > 0;
  } catch (e) {
    return false;
  }
}

/**
 * Detect common typos in email domain
 */
function detectTypo(email) {
  const [, domain] = email.split('@');
  if (!domain) return null;
  
  const suggestion = TYPO_MAP[domain.toLowerCase()];
  if (suggestion) {
    const [localPart] = email.split('@');
    return {
      suggestion: `${localPart}@${suggestion}`,
      typo: `${domain} → ${suggestion}`
    };
  }
  return null;
}

/**
 * Check if email is from disposable domain
 */
function isDisposable(email) {
  const [, domain] = email.split('@');
  return DISPOSABLE_DOMAINS.includes(domain?.toLowerCase());
}

/**
 * Validate a single email address
 */
async function validateEmail(email, options = {}) {
  const {
    checkDNS: shouldCheckDNS = true,
    checkTypos = true,
    timeout = 5000
  } = options;

  const result = {
    email,
    valid: false,
    checks: {
      format: false,
      dns: null,
      disposable: false
    }
  };

  // Check format
  result.checks.format = validateFormat(email);
  if (!result.checks.format) {
    return result;
  }

  // Check for typos
  if (checkTypos) {
    const typo = detectTypo(email);
    if (typo) {
      result.suggestion = typo.suggestion;
      result.typo = typo.typo;
      return result;
    }
  }

  // Check disposable
  result.checks.disposable = isDisposable(email);

  // Check DNS
  if (shouldCheckDNS) {
    const [, domain] = email.split('@');
    result.checks.dns = await checkDNS(domain, timeout);
  }

  // Email is valid if format is good, DNS passes, and not disposable
  result.valid = result.checks.format && 
                 (result.checks.dns !== false) && 
                 !result.checks.disposable;

  return result;
}

/**
 * Validate multiple emails
 */
async function validateBatch(emails, options = {}) {
  return Promise.all(emails.map(email => validateEmail(email, options)));
}

module.exports = {
  validateEmail,
  validateBatch
};
```

## File: LICENSE
size: 1066
sha: a55328b624809bb4584a16bf8bd29b3846012feb
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/LICENSE

```text
MIT License

Copyright (c) 2026 Alex Chen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## File: package.json
size: 561
sha: 3586caacc6236a297f3eb98b9fb25d20938bb546
upstream: https://github.com/alex-vbcoding/email-validator-skill/blob/HEAD/package.json

```text
{
  "name": "email-validator-skill",
  "version": "0.1.0",
  "description": "OpenClaw skill for email validation with DNS checks and typo detection",
  "main": "index.js",
  "scripts": {
    "test": "node test.js"
  },
  "keywords": ["email", "validation", "openclaw", "skill", "dns", "typo"],
  "author": "Alex Chen <alex@metaleap.so>",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/alex-vbcoding/email-validator-skill.git"
  },
  "dependencies": {
    "dns": "^0.2.2"
  },
  "engines": {
    "node": ">=14.0.0"
  }
}
```
