mxprobe-core
v0.2.6
Published
The MX Probe engine: DNS tier, SMTP probe and the send / hold / kill verdict contract. Zero dependencies.
Downloads
1,259
Maintainers
Readme
mxprobe-core
The MX Probe engine. Zero dependencies, Node 20+. Two tiers:
- DNS. Free and local. Finds every domain that cannot receive mail: no MX
and a web host behind the A record, a null MX, an MX that does not
resolve, a domain that does not exist, a parking host as MX. Forwarder MX
hosts (Cloudflare Email Routing, Namecheap, ImprovMX) are a
hold. - SMTP probe. Connects to the MX on port 25, EHLO, MAIL FROM, RCPT TO for the address and for a random local part (the catch-all test), QUIT. No message is ever sent. Needs outbound port 25, which most laptops and clouds block; the hosted API at https://api.mxprobe.dev runs it for you.
import { verify, verifyBatch, createVerifier } from "mxprobe-core";
await verify("[email protected]");
// { email, action: "send" | "hold" | "kill", verdict: "OK" | "WEAK" | "DEAD", reason, checks: { syntax, mx, smtp, catch_all } }
await verifyBatch(["[email protected]", "[email protected]"], { smtp: true, helo: "probe.example.com", from: "[email protected]" });
const v = createVerifier({ smtp: true, smtpConcurrency: 3, autoDisableSmtp: false }); // shared limits across callschecks.smtp is skipped on the DNS tier, else accepted, rejected,
refused, deferred, unreachable or dropped. Only rejected (a 5xx that
names the mailbox) kills; everything else that is not accepted holds.
Options (all optional): smtp, helo, from, port, hostOverride,
dnsTimeoutMs, smtpTimeoutMs, smtpConcurrency, dnsConcurrency,
autoDisableSmtp, resolver (an object with resolveMx, resolve4,
resolve6, reverse, for tests).
Written in TypeScript; the package ships its declarations. VerifyResult,
Action, Verdict, SmtpCheck, Checks, Summary, VerifierOptions,
Resolver and the hosted API's response types (SignupResponse,
VerifyResponse, BalanceResponse, CheckoutResponse, ApiErrorBody)
are exported as types.
MIT. Part of https://github.com/andrewchmr/mxprobe.
