@lacspace/email-verify 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @lacspace/email-verify
|
|
4
|
+
|
|
5
|
+
**Does this mailbox actually exist? — best-effort deliverability checks (MX + SMTP probe).**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@lacspace/email-verify)
|
|
8
|
+
[](https://packagephobia.com/result?p=@lacspace/email-verify)
|
|
9
|
+
[](https://bundlephobia.com/package/@lacspace/email-verify)
|
|
10
|
+
[](https://www.npmjs.com/package/@lacspace/email-verify)
|
|
11
|
+
[](https://github.com/lacspace/npm-packages/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
> Goes one step past syntax: resolves the domain's **MX records** and (optionally) runs a real **SMTP `RCPT TO` probe** to ask the receiving server whether the mailbox exists — **without ever sending a message**. Built on Node's `dns` + `net`.
|
|
16
|
+
|
|
17
|
+
- 🔎 Syntax + disposable (via [`@lacspace/email-validate`](https://www.npmjs.com/package/@lacspace/email-validate))
|
|
18
|
+
- 📇 MX record lookup, sorted by priority
|
|
19
|
+
- 📡 Optional SMTP RCPT probe → `deliverable` / `undeliverable` / `unknown`
|
|
20
|
+
- 🚫 No email is ever sent
|
|
21
|
+
- 🟢 Node 18+ · zero **npm** dependencies (only our own `email-validate`)
|
|
22
|
+
|
|
23
|
+
> ⚠️ **Read this.** Live SMTP verification is inherently unreliable. Many mail servers **greylist**, use **catch-all** (accept every address), or block probes outright — so `unknown` is 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.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @lacspace/email-verify # or pnpm add / yarn add / bun add
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { verifyEmail } from "@lacspace/email-verify";
|
|
35
|
+
|
|
36
|
+
await verifyEmail("someone@gmail.com");
|
|
37
|
+
// {
|
|
38
|
+
// email: "someone@gmail.com",
|
|
39
|
+
// valid: true,
|
|
40
|
+
// syntax: true,
|
|
41
|
+
// disposable: false,
|
|
42
|
+
// role: false,
|
|
43
|
+
// mxFound: true,
|
|
44
|
+
// mxRecords: [{ exchange: "gmail-smtp-in.l.google.com", priority: 5 }, …],
|
|
45
|
+
// smtp: "unknown" // Gmail greylists probes — expected
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// MX-only (fast, reliable, no port-25 needed) — great default in cloud/serverless
|
|
49
|
+
await verifyEmail(email, { checkSmtp: false });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Lower-level helpers
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { resolveMx, smtpCheck } from "@lacspace/email-verify";
|
|
56
|
+
|
|
57
|
+
await resolveMx("lacspace.com");
|
|
58
|
+
// [{ exchange, priority }, …] (sorted best-first; [] if none)
|
|
59
|
+
|
|
60
|
+
await smtpCheck("user@example.com", "mx.example.com", { timeout: 8000 });
|
|
61
|
+
// "deliverable" | "undeliverable" | "unknown"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Options
|
|
65
|
+
|
|
66
|
+
| Option | Default | Description |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `checkSmtp` | `true` | run the live RCPT probe (set `false` for MX-only) |
|
|
69
|
+
| `fromAddress` | `verify@<hostname>` | MAIL FROM used in the probe |
|
|
70
|
+
| `timeout` | `10000` | per-connection timeout (ms) |
|
|
71
|
+
| `extraDisposable` | — | extra throwaway domains |
|
|
72
|
+
|
|
73
|
+
## The Lacspace MailKit
|
|
74
|
+
|
|
75
|
+
| Package | For |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| [`@lacspace/mailer`](https://www.npmjs.com/package/@lacspace/mailer) | Send email over SMTP |
|
|
78
|
+
| [`@lacspace/email-templates`](https://www.npmjs.com/package/@lacspace/email-templates) | Build responsive HTML emails |
|
|
79
|
+
| [`@lacspace/email-validate`](https://www.npmjs.com/package/@lacspace/email-validate) | Validate & normalize addresses |
|
|
80
|
+
| **`@lacspace/email-verify`** | MX + SMTP deliverability checks (this package) |
|
|
81
|
+
|
|
82
|
+
<div align="center"><sub>Built with care by <a href="https://lacspace.com">Lacspace</a> · MIT licensed · <a href="https://github.com/lacspace/npm-packages">source</a></sub></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacspace/email-verify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Best-effort email deliverability checks for Node — syntax + disposable, MX record lookup and an optional SMTP RCPT probe (no mail sent). Zero npm dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"node": ">=18"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@lacspace/email-validate": "^1.0.
|
|
54
|
+
"@lacspace/email-validate": "^1.0.1"
|
|
55
55
|
}
|
|
56
56
|
}
|