@lacspace/email-verify
v1.0.4
Published
Best-effort email deliverability checks for Node — syntax + disposable, MX record lookup and an optional SMTP RCPT probe (no mail sent). Zero npm dependencies.
Maintainers
Readme
@lacspace/email-verify
Does this mailbox actually exist? — best-effort deliverability checks (MX + SMTP probe).
Goes one step past syntax: resolves the domain's MX records and (optionally) runs a real SMTP
RCPT TOprobe to ask the receiving server whether the mailbox exists — without ever sending a message. Built on Node'sdns+net.
- 🔎 Syntax + disposable (via
@lacspace/email-validate) - 📇 MX record lookup, sorted by priority
- 📡 Optional SMTP RCPT probe →
deliverable/undeliverable/unknown - 🚫 No email is ever sent
- 🟢 Node 18+ · zero npm dependencies (only our own
email-validate)
⚠️ Read this. Live SMTP verification is inherently unreliable. Many mail servers greylist, use catch-all (accept every address), or block probes outright — so
unknownis common and a positive means "likely deliverable", never a guarantee. Outbound port 25 is also blocked on many hosts (incl. most serverless/PaaS). Use it to catch obvious typos and dead domains, not as a hard gate.
Install
npm install @lacspace/email-verify # or pnpm add / yarn add / bun addUsage
import { verifyEmail } from "@lacspace/email-verify";
await verifyEmail("[email protected]");
// {
// email: "[email protected]",
// valid: true,
// syntax: true,
// disposable: false,
// role: false,
// mxFound: true,
// mxRecords: [{ exchange: "gmail-smtp-in.l.google.com", priority: 5 }, …],
// smtp: "unknown" // Gmail greylists probes — expected
// }
// MX-only (fast, reliable, no port-25 needed) — great default in cloud/serverless
await verifyEmail(email, { checkSmtp: false });Lower-level helpers
import { resolveMx, smtpCheck } from "@lacspace/email-verify";
await resolveMx("lacspace.com");
// [{ exchange, priority }, …] (sorted best-first; [] if none)
await smtpCheck("[email protected]", "mx.example.com", { timeout: 8000 });
// "deliverable" | "undeliverable" | "unknown"Options
| Option | Default | Description |
| --- | --- | --- |
| checkSmtp | true | run the live RCPT probe (set false for MX-only) |
| fromAddress | verify@<hostname> | MAIL FROM used in the probe |
| timeout | 10000 | per-connection timeout (ms) |
| extraDisposable | — | extra throwaway domains |
The Lacspace MailKit
| Package | For |
| --- | --- |
| @lacspace/mailer | Send email over SMTP |
| @lacspace/email-templates | Build responsive HTML emails |
| @lacspace/email-validate | Validate & normalize addresses |
| @lacspace/email-verify | MX + SMTP deliverability checks (this package) |
Licensing
This package is free under the Lacspace Free Licence — MIT-equivalent freedoms. Use it in personal and commercial projects at no cost; just keep the notice.
Not every Lacspace package is free. We also offer Commercial (paid), Client-specific, and Private (proprietary) packages under separate terms. See the full Lacspace Licence Centre.
Part of the Lacspace ecosystem — 35 zero-dependency, isomorphic TypeScript packages.
