@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.
27 lines (26 loc) • 1.31 kB
TypeScript
/**
* `MAIL FROM:` payload resolution from a `SMTPSenderStrategy` policy.
*
* Pure functions — no I/O, no shared state. The randomness comes from
* `crypto.randomBytes` (same primitive used by the catch-all probe local
* generator in `smtp-verifier.ts`) so probes can't be fingerprinted by a
* predictable PRNG.
*/
import type { SMTPSenderStrategy } from './types';
/**
* Resolve a sender strategy into the literal `MAIL FROM:` payload (including
* angle brackets). Output is ready to drop into `MAIL FROM:${result}`.
*
* Examples (with random=`a3x9b7c2deadbeef`):
* `{ kind: 'null-sender' }` → `<>`
* `{ kind: 'fixed', address: 'verify@x.com' }` → `<verify@x.com>`
* `{ kind: 'fixed', address: '<verify@x.com>' }` → `<verify@x.com>` (already wrapped)
* `{ kind: 'random-at-recipient' }` → recipient `alice@gmail.com`
* → `<probe-a3x9b7c2deadbeef@gmail.com>`
* `{ kind: 'random-at-domain', domain: 'x.com' }` → `<probe-a3x9b7c2deadbeef@x.com>`
* `{ kind: 'custom', build: r => `<x@${r.domain}>` }` → whatever `build` returns
*/
export declare function resolveSenderAddress(strategy: SMTPSenderStrategy, recipient: {
local: string;
domain: string;
}): string;