Skip to content

A fast and efficient email validation toolkit built with Bun

License

Notifications You must be signed in to change notification settings

9vs/email-toolkit

Repository files navigation

Email Toolkit

A fast and efficient email validation toolkit built with Bun. This package provides utilities for:

  • Email format validation using regex
  • Disposable email detection with auto-updating domain list
  • Domain extraction and validation
  • Email existence checking via MX records and SMTP verification

Installation

bun add email-toolkit

Usage

import { EmailToolkit } from "email-toolkit";

const toolkit = new EmailToolkit();

// Comprehensive validation
const result = await toolkit.validateEmail("test@example.com");
console.log(result);
// {
// isValid: true,
// domain: "example.com",
// isDisposable: false,
// exists: true,
// hasValidMX: true
// }

// Individual utilities
toolkit.isValidEmail("test@example.com"); // true
toolkit.isDisposableDomain("temp-mail.org"); // true
toolkit.getDomain("test@example.com"); // "example.com"

Features

Comprehensive Validation

  • Format validation using robust regex patterns
  • MX record verification
  • SMTP connection testing (with fallback)
  • Disposable email domain detection

Performance

  • Built with Bun for optimal speed
  • MX record caching
  • Efficient domain lookup using Set
  • Minimal dependencies

API Reference

new EmailToolkit()

Creates a new toolkit instance.

validateEmail(email)

Performs comprehensive email validation including format, MX records, SMTP verification, and disposable domain detection.

isValidEmail(email)

Checks if email format is valid and has valid MX records.

isDisposableDomain(domain)

Checks if domain is known to be disposable.

getDomain(email)

Extracts and returns the domain from an email address.

About

A fast and efficient email validation toolkit built with Bun

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published