@emailcheck/email-validator-js
Version:
Advanced email validation with MX records, SMTP verification, disposable email detection, batch processing, and caching. Production-ready with TypeScript support.
32 lines (31 loc) • 1.24 kB
TypeScript
/**
* Spam detection helper for email addresses.
* Detects artificially generated email addresses using linguistic heuristics.
*/
/**
* Checks if an email address appears to be spam/generated.
*
* Spam characteristics detected:
* - Unusually long local part (16+ characters before @)
* - Low vowel ratio (< 35%) - real words typically have higher vowel density
* - High uppercase ratio (> 30%) - indicating random capitalization
* - High consonant cluster ratio - many consecutive consonants
* - Repeated character patterns (e.g., "aaaa", "xxx")
* - Random-looking character sequences
*
* @param email - The email address to validate
* @returns true if the email appears to be spam, false otherwise
*
* @example
* isSpamEmail("FalDxivcRyvFRbMU@example.com") // true
* isSpamEmail("john.doe@example.com") // false
*/
export declare function isSpamEmail(email: string): boolean;
/**
* Checks if an email address local part appears to be spam/generated.
* This is an alias for isSpamEmail with a more descriptive name.
*
* @param email - The email address to validate
* @returns true if the email local part appears to be spam, false otherwise
*/
export declare function isSpamEmailLocalPart(email: string): boolean;