Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@mikkelscheike/email-provider-links

mikkelscheike915MIT2.8.0TypeScript support: included

TypeScript library for email provider detection with 93 providers (207 domains), concurrent DNS resolution, optimized performance, 91.75% test coverage, and enterprise security for login and password reset flows

email, provider, login, password-reset, gmail, outlook, yahoo, alias-detection, email-normalization, plus-addressing, fraud-prevention, deduplication, typescript, npm, utility

readme

Email Provider Links

🔒 Modern email provider detection library with enhanced TypeScript support and enterprise security

A robust TypeScript library providing direct links to 93 email providers (180 domains) with concurrent DNS resolution, optimized performance, comprehensive email validation, and advanced security features for login and password reset flows.

🚀 Try it out

Live Demo - Test the library with any email address and see it in action!

✨ New in Version 2.7.0

  • 🚀 Modern TypeScript: Updated to latest TypeScript 2025 standards with strict type checking
  • 🌍 Enhanced International Support: Improved IDN validation and Punycode handling
  • 📧 Advanced Email Validation: Comprehensive validation with detailed error reporting
  • 🔄 Batch Processing: Efficiently process multiple emails with deduplication
  • 🛡️ Improved Security: Enhanced cryptographic integrity verification
  • Better Performance: Optimized concurrent DNS with smart caching
  • 🎯 Developer Experience: Enhanced error messages and debugging information
  • 📊 Development Mode: Memory usage tracking when NODE_ENV=development

✨ Core Features

  • 🚀 Fast & Lightweight: Zero dependencies, ultra-low memory (~0.08MB initial, ~0.03MB per 1000 ops)
  • 📧 93 Email Providers: Gmail, Outlook, Yahoo, ProtonMail, iCloud, and many more
  • 🌐 207 Domains Supported: Comprehensive international coverage
  • 🌍 Full IDN Support: International domain names with RFC compliance and Punycode
  • Advanced Email Validation: International email validation with detailed error reporting
  • 🏢 Business Domain Detection: DNS-based detection for custom domains (Google Workspace, Microsoft 365, etc.)
  • 🔒 Enterprise Security: Multi-layer protection against malicious URLs and supply chain attacks
  • 🛡️ URL Validation: HTTPS-only enforcement with domain allowlisting
  • 🔐 Integrity Verification: Cryptographic hash verification for data integrity
  • 📝 Type Safe: Full TypeScript support with comprehensive interfaces
  • Performance Optimized: Smart DNS fallback with configurable timeouts
  • 🚦 Rate Limiting: Built-in DNS query rate limiting to prevent abuse
  • 🔄 Email Alias Detection: Normalize Gmail dots, plus addressing, and provider-specific aliases
  • 🛡️ Fraud Prevention: Detect duplicate accounts through email alias manipulation
  • 📦 Batch Processing: Efficiently process multiple emails with deduplication
  • 🧪 Thoroughly Tested: 424 tests with 93.16% code coverage

Installation

Using npm:

npm install @mikkelscheike/email-provider-links

Requirements

  • Node.js: >=18.0.0 (Tested on 18.x, 20.x, 22.x, 24.x)
  • TypeScript: >=4.0.0 (optional, but recommended)
  • Zero runtime dependencies - No external packages required

Node.js 24 Support ✨

Fully compatible with the latest Node.js 24.x! The library is tested on:

  • Node.js 18.x (LTS)
  • Node.js 20.x (LTS)
  • Node.js 22.x (Current)
  • Node.js 24.x (Latest) - Full support with latest features

Supported Providers

📊 Current Coverage: 93 providers supporting 207 domains

Consumer Email Providers:

  • Gmail (2 domains): gmail.com, googlemail.com
  • Microsoft Outlook (15 domains): outlook.com, hotmail.com, live.com, msn.com, and 11 more
  • Yahoo Mail (19 domains): yahoo.com, yahoo.co.uk, yahoo.fr, ymail.com, rocketmail.com, and 14 more
  • ProtonMail (4 domains): proton.me, protonmail.com, protonmail.ch, pm.me
  • iCloud Mail (3 domains): icloud.com, me.com, mac.com
  • Tutanota (6 domains): tutanota.com, tutanota.de, tutamail.com, tuta.io, keemail.me, tuta.com
  • SimpleLogin (10 domains): simplelogin.io, 8alias.com, aleeas.com, slmail.me, and 6 more
  • FastMail, Zoho Mail, AOL Mail, GMX, Web.de, Mail.ru, QQ Mail, NetEase, Yandex, and many more

Business Email (via DNS detection):

  • Microsoft 365 (Business domains via MX/TXT records)
  • Google Workspace (Custom domains via DNS patterns)
  • Amazon WorkMail (AWS email infrastructure via awsapps.com patterns)
  • Zoho Workplace, FastMail Business, GoDaddy Email, Bluehost Email
  • ProtonMail Business, Rackspace Email, IONOS, and others

Security & Privacy Focused:

  • ProtonMail, Tutanota, Hushmail, CounterMail, Posteo
  • Mailfence, SimpleLogin, AnonAddy

International Providers:

  • Europe: GMX, Web.de, Orange, Free.fr, T-Online, Libero, Virgilio, Telekom, Tiscali, Skynet, Telenet, Xs4All, Planet.nl, Bluewin, Eircom
  • Asia: QQ Mail, NetEase, Sina Mail, Alibaba Mail, Rakuten, Nifty, Naver (Korea), Daum (Korea), Biglobe (Japan), Sify, IndiatTimes (India)
  • Eastern Europe: Centrum (Czech/Slovak), Interia, Onet (Poland), Rambler (Russia)
  • Other Regions: UOL, Terra (Brazil), Telkom (South Africa), Xtra (New Zealand)

API Reference

getEmailProvider(email, timeout?)

Recommended - Detects any email provider including business domains.

// 🚀 SAME CALL, DIFFERENT SCENARIOS:

// ✅ For known providers (Gmail, Yahoo, etc.) - INSTANT response
const gmail1 = await getEmailProvider('user@gmail.com');        // No timeout needed
const gmail2 = await getEmailProvider('user@gmail.com', 3000);  // Same speed - timeout ignored
// Both return instantly: { provider: "Gmail", loginUrl: "https://mail.google.com/mail/" }

// 🔍 For business domains - DNS lookup required, timeout matters
const biz1 = await getEmailProvider('user@mycompany.com');        // 5000ms timeout (default)
const biz2 = await getEmailProvider('user@mycompany.com', 2000);  // 2000ms timeout (faster fail)
const biz3 = await getEmailProvider('user@mycompany.com', 10000); // 10000ms timeout (slower networks)
// All may detect: { provider: "Google Workspace", detectionMethod: "mx_record" }

// 🎯 WHY USE CUSTOM TIMEOUT?
// - Faster apps: Use 2000ms to fail fast on unknown domains
// - Slower networks: Use 10000ms to avoid premature timeouts
// - Enterprise: Use 1000ms for strict SLA requirements

getEmailProviderSync(email)

Synchronous - Only checks predefined domains (no DNS lookup).

const result = getEmailProviderSync('user@gmail.com');
// Returns: { provider, loginUrl, email }

getEmailProviderFast(email, options?)

High-performance - Concurrent DNS with detailed timing information.

const result = await getEmailProviderFast('user@mycompany.com', {
  enableParallel: true,
  collectDebugInfo: true,
  timeout: 3000
});

console.log(result.timing);    // { mx: 120, txt: 95, total: 125 }
console.log(result.confidence); // 0.9

Real-World Example

async function handlePasswordReset(email: string) {
  // Validate email first
  const validation = validateEmailAddress(email);
  if (!validation.isValid) {
    throw new Error(`Invalid email: ${validation.error?.message}`);
  }

  // Get provider information
  const result = await getEmailProvider(validation.normalizedEmail);

  return {
    providerUrl: result.loginUrl,
    providerName: result.provider?.companyProvider || null,
    isSupported: result.provider !== null,
    detectionMethod: result.detectionMethod
  };
}

Configuration

// Custom DNS timeout (default: 5000ms)
const result = await getEmailProvider(email, 2000);

// Rate limiting configuration
import { Config } from '@mikkelscheike/email-provider-links';
console.log('Max requests:', Config.MAX_DNS_REQUESTS_PER_MINUTE); // 10
console.log('Default timeout:', Config.DEFAULT_DNS_TIMEOUT);       // 5000ms

Advanced Usage

<summary>📚 Advanced Features & Specialized Use Cases</summary>

Library Statistics

import { getLibraryStats, getSupportedProviders } from '@mikkelscheike/email-provider-links';

const stats = getLibraryStats();
console.log(`Version ${stats.version} supports ${stats.providerCount} providers`);

const providers = getSupportedProviders();
console.log(`Total providers: ${providers.length}`);

Email Alias Detection & Normalization

import { 
  normalizeEmail, 
  emailsMatch 
} from '@mikkelscheike/email-provider-links';

// Prevent duplicate accounts
async function registerUser(email: string) {
  const canonical = normalizeEmail(email);
  const existingUser = await findUserByEmail(canonical);

  if (existingUser) {
    throw new Error('Email already registered');
  }

  await createUser({ email: canonical });
}

// Check if login email matches registration
const match = emailsMatch('user@gmail.com', 'u.s.e.r+work@gmail.com');
console.log(match); // true - same person

// Simple normalization
const canonical = normalizeEmail('u.s.e.r+work@gmail.com');
console.log(canonical);  // 'user@gmail.com'

Provider Support Checking

import { isEmailProviderSupported, extractDomain } from '@mikkelscheike/email-provider-links';

// Check if provider is supported
const supported = isEmailProviderSupported('user@gmail.com');

// Extract domain safely
const domain = extractDomain('USER@EXAMPLE.COM');
console.log(domain); // 'example.com'

Performance and Detection System

For detailed performance metrics and information about the detection system, refer to Performance and Detection System.

Development Mode Features

When NODE_ENV is set to 'development', the library provides additional insights:

// Memory usage is automatically logged:
// 🚀 Current memory usage: 0.08 MB

Memory Management

The library implements careful memory management:

  • Initial load: ~0.08MB heap usage
  • Batch operations: ~0.03MB per 1000 operations
  • Maximum load: < 25MB even under heavy concurrent operations
  • Automatic garbage collection hints
  • Memory usage logging in development mode

Performance Benchmarks

This package is designed to be extremely memory efficient and fast:

  • Provider loading: ~0.08MB heap usage, ~0.5ms
  • Email lookups: ~0.03MB heap usage per 100 operations
  • Concurrent DNS: ~0.03MB heap usage, ~27ms for 10 lookups
  • Large scale (1000 ops): ~0.03MB heap usage, ~1.1ms total
  • International validation: <1ms for complex IDN domains

To run benchmarks locally:

npm run benchmark

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines on adding new email providers.

Quality Assurance: This project maintains high standards with 424 comprehensive tests achieving 93.16% code coverage (96.46% function coverage). Security Note: All new providers undergo security validation and must pass our allowlist verification.

Security

For security concerns or to report vulnerabilities, see our Security Policy.

License

MIT License - see LICENSE file for details.


Zero dependencies • TypeScript-first • Production ready • International support

changelog

Changelog

[2.7.1] - 2025-06-27

Fixed

  • CI workflow reliability improvements
  • Benchmark stability enhancements

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[2.7.0] - 2025-06-27

🚀 Major Enhancement Release - Modern TypeScript & Enhanced Developer Experience

✨ Modern TypeScript Support

  • Upgraded to TypeScript 2025 Standards with latest compiler options
  • Strict Type Checking with enhanced null safety and exactOptionalPropertyTypes
  • Better Error Messages with improved type inference and debugging
  • Enhanced Module Resolution using NodeNext for better compatibility

📧 Advanced Email Validation

  • Enhanced validateEmailAddress() function with comprehensive error reporting
  • Detailed Error Contexts with specific error codes and user-friendly messages
  • Improved International Support with better IDN handling
  • Input Sanitization with robust validation for all input types

📦 Batch Processing & Performance

  • New batchProcessEmails() function for efficient bulk processing
  • Alias Deduplication to detect and handle duplicate email addresses
  • Provider Information Enrichment with optional metadata inclusion
  • Memory-Efficient Processing for large email datasets

🔍 Enhanced Library Utilities

  • getLibraryStats() for comprehensive library metadata
  • Improved getSupportedProviders() with defensive copying
  • Enhanced Domain Extraction with better error handling
  • Robust Provider Support Checking with fallback mechanisms

🛡️ Security & Robustness Improvements

  • Enhanced Hash Verification with optional reason fields
  • Improved Error Handling throughout the codebase
  • Better Input Validation with comprehensive type checking
  • Defensive Programming patterns to prevent runtime errors

🎯 Developer Experience

  • New Modern Example (examples/modern-example.ts) showcasing all features
  • Enhanced Documentation with comprehensive API reference
  • Better Type Exports for improved IntelliSense support
  • Improved Error Messages with actionable guidance

⚡ Performance Optimizations

  • Optimized Concurrent DNS with better error handling
  • Smart Caching Strategies for improved performance
  • Memory Usage Optimizations for large-scale operations
  • Faster Compilation with modern TypeScript configuration

🧪 Enhanced Testing

  • 396 Comprehensive Tests with excellent coverage
  • All Tests Passing with improved reliability
  • Enhanced Error Scenario Testing for edge cases
  • Better Test Structure with modern testing patterns

🔄 API Enhancements (Non-Breaking)

  • Backward Compatibility Maintained for all existing APIs
  • Enhanced Return Types with better type information
  • Improved Error Contexts with detailed error information
  • Optional Property Handling with safer type checking

📚 Documentation & Examples

  • Updated README with new features and enhanced examples
  • Modern Example File demonstrating all capabilities
  • Enhanced TypeScript Documentation with better type information
  • Improved API Documentation with comprehensive examples

🔥 Technical Improvements

  • Code Quality: Enhanced with modern TypeScript patterns
  • Type Safety: Improved with stricter type checking
  • Error Handling: Comprehensive error contexts throughout
  • Performance: Optimized hot paths and memory usage
  • Security: Enhanced validation and integrity checking

🛠 Development Experience

  • Better IntelliSense: Enhanced type definitions and documentation
  • Improved Debugging: Better error messages and context
  • Modern Tooling: Updated to latest TypeScript standards
  • Enhanced Examples: Comprehensive demonstration of features

[2.6.0] - 2025-06-24

🌐 International Email Validation

Added

  • Comprehensive Email Validation following RFC 5321, 5322, and 6530 standards
  • Full IDN Support with Punycode validation
  • Clear Error Messages designed for translation
  • RFC-Compliant Checks for all email components

New Features

  • validateInternationalEmail() function for complete validation
  • Detailed error codes and messages
  • Length validation for all email parts
  • IDN (Punycode) validation for domains

Enhanced Tests

  • 396 comprehensive tests (up from 370)
  • 93.29% overall code coverage
  • 98.24% coverage for IDN validation
  • Added memory leak detection for worker processes

Non-Breaking Changes

  • Added new validation function that maintains backward compatibility
  • Enhanced error messages for better internationalization
  • Improved IDN support in existing functions

⚡ Additional Enhancements

  • Memory Optimization: New benchmark results showing:
    • Initial load: ~0.39MB heap usage, <0.5ms
    • Cache performance: ~0.01MB impact
    • Async lookups: ~0.15MB heap usage
    • Large scale (1000 ops): ~0.02MB heap usage, <3ms
    • Minimal footprint with efficient garbage collection

🔥 Removed

  • Bun Support: Completely removed Bun-specific configuration and dependencies

🛠 CI/CD

  • CI Triggers: Improved CI configuration to trigger builds for all branches

🛡️ Security

  • Integrity Checks: Enhanced hash verification and data integrity checks for provider files

[2.0.0] - 2024-06-21

✨ Features

  • Primary API: getEmailProvider() async function for comprehensive email provider detection
  • Concurrent DNS Resolution: High-performance parallel DNS queries for business domain detection
  • Provider Database: 93 email providers supporting 178 domains with global coverage
  • Email Normalization: Advanced alias detection with normalizeEmail() and emailsMatch() functions
  • Enterprise Security: Multi-layer protection with URL validation and integrity verification
  • TypeScript Support: Full type safety with comprehensive interfaces
  • Zero Dependencies: Lightweight package with no external dependencies

🔒 Security

  • URL Validation: HTTPS enforcement with domain allowlisting
  • Attack Prevention: Protection against typosquatting, URL injection, and script injection
  • Integrity Verification: SHA-256 hash verification for data integrity
  • 92 Security Tests: Comprehensive security testing covering all attack vectors

🧪 Testing & Quality

  • 91.75% Test Coverage: 371 comprehensive tests covering all functionality
  • Schema Validation: Complete testing of data validation and compression
  • Security Testing: Extensive testing of attack scenarios and security patterns
  • Performance Testing: High-resolution timing tests for concurrent operations

🚀 Performance

  • Optimized Data Schema: Compressed provider data reducing bundle size by 10-30%
  • Smart Caching: Efficient provider loading with performance monitoring
  • Concurrent Processing: Parallel DNS queries for faster business domain detection
  • Memory Efficiency: Optimized data structures and reduced memory footprint

📚 API Functions

  • getEmailProvider(email, timeout?) - Primary function for all provider detection
  • getEmailProviderSync(email) - Synchronous detection for known domains
  • normalizeEmail(email) - Email alias normalization
  • emailsMatch(email1, email2) - Compare emails accounting for aliases
  • getSupportedProviders() - List all supported providers
  • isEmailProviderSupported(email) - Check provider support
  • Utility functions: isValidEmail(), extractDomain()

[1.7.0] - 2025-06-20

🚀 Major Features Added

Email Alias Detection & Normalization

  • NEW: Comprehensive email alias detection system
  • NEW: Smart normalization for Gmail dots (`u.s.e.r@gmail.comuser@gmail.com`)
  • NEW: Plus addressing support (`user+tag@provider.comuser@provider.com`)
  • NEW: Provider-specific aliasing rules (12 major providers)
  • NEW: Email deduplication and fraud prevention capabilities
  • NEW: Alias generation tools for testing and development

Massive Provider Expansion

  • EXPANDED: From 74 to 93 email providers (+19 new providers)
  • EXPANDED: From 147+ to 180+ domain coverage (+30+ domains)
  • NEW: Comprehensive Asian provider coverage (China, India, Korea, Japan)
  • NEW: Extended European provider support (Italy, Germany, Belgium, Netherlands, Switzerland, Ireland)
  • NEW: Eastern European providers (Czech Republic, Slovakia, Poland, Russia)

🌍 New Email Providers Added

Asian Providers

  • Alibaba Mail (aliyun.com, alibaba.com, taobao.com, tmall.com) - China's largest e-commerce email
  • Sify Mail (sify.com, sifymail.com) - Leading Indian ISP email
  • IndiatTimes Mail (indiatimes.com) - Popular Indian email service
  • Nate Mail (nate.com) - Korean email provider
  • Hanmail (hanmail.net) - Korean email service
  • Live.jp (live.jp) - Microsoft Japan localized email

European Providers

  • Virgilio Mail (virgilio.it, alice.it, tin.it) - Italian email services
  • Telekom Mail (magenta.de, telekom.de) - German telecommunications email
  • Tiscali Mail (tiscali.it) - Italian ISP email
  • Skynet Mail (skynet.be) - Belgian email provider
  • Telenet Mail (telenet.be) - Belgian telecommunications email
  • Xs4All (xs4all.nl) - Dutch internet provider email
  • Planet.nl (planet.nl) - Dutch email service
  • Bluewin Mail (bluewin.ch) - Swiss telecommunications email
  • Eircom Mail (eircom.net) - Irish telecommunications email

Eastern European Providers

  • Centrum Mail (centrum.cz, centrum.sk) - Czech/Slovak email portal
  • Interia Mail (interia.pl) - Polish email service
  • Onet Mail (onet.pl, poczta.onet.pl, op.pl) - Polish web portal email
  • Rambler Mail (rambler.ru, lenta.ru, autorambler.ru) - Russian email service

🔧 API Enhancements

New Functions

  • detectEmailAlias() - Analyzes email aliases and returns normalization info
  • normalizeEmail() - Converts email to canonical form
  • emailsMatch() - Checks if two emails are equivalent when normalized
  • getAliasCapabilities() - Returns provider's aliasing capabilities
  • generateAliases() - Creates potential aliases for testing
  • analyzeEmailAliases() - Analyzes email lists for patterns and statistics

Enhanced Exports

  • All alias detection functions exported from main module
  • Comprehensive TypeScript interfaces for alias detection
  • Full backward compatibility maintained

🧪 Testing & Quality

Expanded Test Coverage

  • INCREASED: From 142 to 321 tests (+179 new tests)
  • NEW: Comprehensive alias detection test suite (46 tests)
  • NEW: Provider-specific aliasing behavior validation
  • NEW: Edge case testing for complex alias scenarios
  • NEW: Concurrent DNS detection test suite (50+ tests)
  • NEW: Security validation tests (29 tests)
  • ACHIEVED: 78% code coverage across all modules

Test Categories Added

  • Gmail alias normalization (dots + plus addressing)
  • Outlook/Hotmail plus addressing (dots preserved)
  • Yahoo/ProtonMail/iCloud plus addressing
  • AOL (no aliasing support) validation
  • Cross-provider alias matching
  • Bulk email analysis and statistics
  • Alias generation and validation

🛡️ Security & Integrity

Updated Security Hashes

  • UPDATED: Provider database hash for 93 providers
  • UPDATED: Package.json hash for v1.7.0
  • MAINTAINED: Enterprise-grade integrity verification
  • MAINTAINED: Multi-layer security protection

Security Features

  • PRESERVED: All existing security validations
  • ENHANCED: Hash verification for expanded database
  • MAINTAINED: HTTPS-only URL enforcement
  • MAINTAINED: Domain allowlisting and tamper detection

📊 Performance & Metrics

Package Efficiency

  • SIZE: 24.4 kB compressed (98.3 kB unpacked) - unchanged despite 25% more providers
  • PERFORMANCE: O(1) domain lookups maintained
  • MEMORY: Efficient alias detection algorithms
  • STARTUP: Fast initialization with optimized data structures

Coverage Statistics

  • Providers: 93 (+19)
  • Domains: 180+ (+33)
  • Tests: 321 (+179)
  • Code Coverage: 78% statement coverage
  • Countries: 25+ regions covered
  • Security Tests: 29 comprehensive security validations

🔄 Backward Compatibility

Fully Compatible

  • API: All existing functions work unchanged
  • TYPES: No breaking TypeScript interface changes
  • BEHAVIOR: Existing detection logic preserved
  • MIGRATION: Zero code changes required for existing users

Optional New Features

  • ADDITIVE: Alias detection is opt-in via new functions
  • NON-BREAKING: New features don't affect existing workflows
  • EXTENSIBLE: New capabilities enhance existing functionality

📚 Documentation & Examples

New Documentation

  • NEW: Comprehensive alias detection examples
  • NEW: Provider capability reference
  • NEW: Email normalization guide
  • NEW: Fraud prevention patterns
  • UPDATED: API documentation with new functions

Example Files

  • NEW: example-alias-detection.ts - Complete alias detection showcase
  • UPDATED: README with new features and provider counts
  • MAINTAINED: All existing examples and documentation

🔧 Development Experience

Enhanced TypeScript Support

  • NEW: AliasDetectionResult interface
  • NEW: AliasRule interface for provider capabilities
  • NEW: Comprehensive type definitions for all alias functions
  • MAINTAINED: Full type safety across all modules

Developer Tools

  • MAINTAINED: All existing developer utilities
  • ENHANCED: Security hash recalculation for expanded database
  • PRESERVED: Build and test automation

🚀 What's Next

This release establishes the foundation for advanced email handling features. Future releases may include:

  • SMTP/IMAP configuration detection
  • OAuth provider mapping
  • Advanced business domain analysis
  • Real-time provider status monitoring

Previous Releases

[1.6.0] - 2025-06-20

  • Added Korean providers (Naver, Daum)
  • Added Japanese provider (Biglobe)
  • Added Amazon WorkMail enterprise support
  • Enhanced international coverage
  • Improved DNS detection and rate limiting

[1.5.1] - 2025-06-19

  • Database cleanup and duplicate removal
  • Enhanced security validation
  • Improved test coverage
  • Documentation updates

[1.5.0] - 2025-06-18

  • Major provider database expansion
  • Enhanced security features
  • Rate limiting system
  • Comprehensive international coverage

Full Changelog: https://github.com/mikkelscheike/email-provider-links/compare/v1.6.0...v1.7.0