@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.36 kB
TypeScript
/**
* Post-hoc classifier for free-form SMTP error messages.
*
* The library's own probe (`smtp-verifier.ts`) classifies live SMTP replies at
* the wire level — that flow does not use this function. `parseSmtpError` is
* a public utility for callers who have a flattened error string in hand
* (e.g. `result.smtp.error`, the `message` of a thrown exception, or a
* provider-specific bounce message logged elsewhere) and want a structured
* verdict.
*
* Returns four orthogonal signals:
* - `isDisabled` — recipient does not exist / account locked / blocked
* - `hasFullInbox` — quota / storage limit / 452 / 552
* - `isCatchAll` — domain accepts every recipient
* - `isInvalid` — caller-friendly default: nothing else matched and the
* error isn't a known transient/rate-limit pattern
*
* The categories are independent — a single message can be both `isDisabled`
* and `hasFullInbox` if its text matches both groups.
*/
export interface ParsedSmtpError {
isDisabled: boolean;
hasFullInbox: boolean;
isCatchAll: boolean;
isInvalid: boolean;
}
/**
* Classify a free-form SMTP error message. Empty / null input returns the
* "everything-false except isInvalid" shape since we have no signal.
*/
export declare function parseSmtpError(errorMessage: string): ParsedSmtpError;