@visulima/email-verifier 1.0.0 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -1,29 +1,43 @@
1
+ ## @visulima/email-verifier [1.0.2](https://github.com/visulima/visulima/compare/%40visulima%2Femail-verifier%401.0.1...%40visulima%2Femail-verifier%401.0.2) (2026-08-02)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/disposable-email-domains:** upgraded to 1.1.0
7
+ * **@visulima/email-provider-mx:** upgraded to 1.0.1
8
+ * **@visulima/free-email-domains:** upgraded to 1.0.1
9
+
10
+ ## @visulima/email-verifier [1.0.1](https://github.com/visulima/visulima/compare/%40visulima%2Femail-verifier%401.0.0...%40visulima%2Femail-verifier%401.0.1) (2026-07-15)
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * **@visulima/disposable-email-domains:** upgraded to 1.0.1
16
+
1
17
  ## @visulima/email-verifier 1.0.0 (2026-07-03)
2
18
 
3
19
  ### Features
4
20
 
5
- * **email:** emailable-parity verification & enrichment packages ([#718](https://github.com/visulima/visulima/issues/718)) ([e2d8c1e](https://github.com/visulima/visulima/commit/e2d8c1e78e3e0c2548ece87b20d730dab60f677a))
21
+ - **email:** emailable-parity verification & enrichment packages ([#718](https://github.com/visulima/visulima/issues/718)) ([e2d8c1e](https://github.com/visulima/visulima/commit/e2d8c1e78e3e0c2548ece87b20d730dab60f677a))
6
22
 
7
23
  ### Miscellaneous Chores
8
24
 
9
- * **release:** @visulima/email-verifier@1.0.0-alpha.1 [skip ci]\n\n## @visulima/email-verifier 1.0.0-alpha.1 (2026-06-30) ([2f54bf0](https://github.com/visulima/visulima/commit/2f54bf0d4eced72aea511f282df9c132e965aac7))
10
-
25
+ - **release:** @visulima/email-verifier@1.0.0-alpha.1 [skip ci]\n\n## @visulima/email-verifier 1.0.0-alpha.1 (2026-06-30) ([2f54bf0](https://github.com/visulima/visulima/commit/2f54bf0d4eced72aea511f282df9c132e965aac7))
11
26
 
12
27
  ### Dependencies
13
28
 
14
- * **@visulima/disposable-email-domains:** upgraded to 1.0.0
15
- * **@visulima/email-provider-mx:** upgraded to 1.0.0
16
- * **@visulima/free-email-domains:** upgraded to 1.0.0
29
+ - **@visulima/disposable-email-domains:** upgraded to 1.0.0
30
+ - **@visulima/email-provider-mx:** upgraded to 1.0.0
31
+ - **@visulima/free-email-domains:** upgraded to 1.0.0
17
32
 
18
33
  ## @visulima/email-verifier 1.0.0-alpha.1 (2026-06-30)
19
34
 
20
35
  ### Features
21
36
 
22
- * **email:** emailable-parity verification & enrichment packages ([#718](https://github.com/visulima/visulima/issues/718)) ([e2d8c1e](https://github.com/visulima/visulima/commit/e2d8c1e78e3e0c2548ece87b20d730dab60f677a))
23
-
37
+ - **email:** emailable-parity verification & enrichment packages ([#718](https://github.com/visulima/visulima/issues/718)) ([e2d8c1e](https://github.com/visulima/visulima/commit/e2d8c1e78e3e0c2548ece87b20d730dab60f677a))
24
38
 
25
39
  ### Dependencies
26
40
 
27
- * **@visulima/disposable-email-domains:** upgraded to 1.0.0-alpha.18
28
- * **@visulima/email-provider-mx:** upgraded to 1.0.0-alpha.1
29
- * **@visulima/free-email-domains:** upgraded to 1.0.0-alpha.1
41
+ - **@visulima/disposable-email-domains:** upgraded to 1.0.0-alpha.18
42
+ - **@visulima/email-provider-mx:** upgraded to 1.0.0-alpha.1
43
+ - **@visulima/free-email-domains:** upgraded to 1.0.0-alpha.1
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The result of local-part character analysis.
3
- */
2
+ * The result of local-part character analysis.
3
+ */
4
4
  interface CharacterResult {
5
5
  /** Ratio of digits to total characters in the local part (0–1). */
6
6
  digitRatio: number;
@@ -12,20 +12,20 @@ interface CharacterResult {
12
12
  reasons: string[];
13
13
  }
14
14
  /**
15
- * Analyzes the local part of an email for irregular characteristics that
16
- * correlate with low-quality, spam-trap, or machine-generated addresses.
17
- *
18
- * Heuristic and intentionally conservative — it flags *patterns* (excessive
19
- * length, digit-heavy locals, long unpronounceable consonant runs, long repeats)
20
- * rather than asserting invalidity.
21
- * @param email The email address to analyze.
22
- * @returns The character analysis result.
23
- * @example
24
- * ```ts
25
- * import { analyzeCharacters } from "@visulima/email-verifier/checks/character";
26
- *
27
- * analyzeCharacters("aaaaaaa@example.com").irregular; // long repeat ⇒ true
28
- * ```
29
- */
15
+ * Analyzes the local part of an email for irregular characteristics that
16
+ * correlate with low-quality, spam-trap, or machine-generated addresses.
17
+ *
18
+ * Heuristic and intentionally conservative — it flags *patterns* (excessive
19
+ * length, digit-heavy locals, long unpronounceable consonant runs, long repeats)
20
+ * rather than asserting invalidity.
21
+ * @param email The email address to analyze.
22
+ * @returns The character analysis result.
23
+ * @example
24
+ * ```ts
25
+ * import { analyzeCharacters } from "@visulima/email-verifier/checks/character";
26
+ *
27
+ * analyzeCharacters("aaaaaaa@example.com").irregular; // long repeat ⇒ true
28
+ * ```
29
+ */
30
30
  declare const analyzeCharacters: (email: string) => CharacterResult;
31
31
  export { type CharacterResult, analyzeCharacters, analyzeCharacters as default };
@@ -1 +1 @@
1
- export { type C as Cache, type I as InMemoryCache, type M as MxCheckOptions, type b as MxCheckResult, type c as MxRecord, type d as MxResolution, e as checkMxRecords, e as default } from "../packem_shared/mx.d-NAesS5sg.js";
1
+ export { type C as Cache, type I as InMemoryCache, type M as MxCheckOptions, type b as MxCheckResult, type c as MxRecord, type d as MxResolution, e as checkMxRecords, e as default } from "../packem_shared/mx.d-HxIDdxvR.js";
package/dist/checks/mx.js CHANGED
@@ -1 +1 @@
1
- import{createRequire as d}from"node:module";const u=d(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return u(e)},{resolveMx:v,resolve4:p,resolve6:h}=f("node:dns/promises"),c=async e=>{try{if((await p(e)).length>0)return!0}catch{}try{return(await h(e)).length>0}catch{return!1}},l=e=>({domainResolves:!0,records:[{exchange:e,priority:0}],resolvedVia:"address",valid:!0}),g=async(e,r)=>{try{const s=(await v(e)).map(t=>({exchange:t.exchange,priority:t.priority}));return s.length>0?{domainResolves:!0,records:s.toSorted((t,a)=>t.priority-a.priority),resolvedVia:"mx",valid:!0}:r&&await c(e)?l(e):{domainResolves:!1,records:[],resolvedVia:"none",valid:!1}}catch(s){return r&&await c(e)?l(e):{domainResolves:!1,error:s instanceof Error?s.message:String(s),resolvedVia:"none",valid:!1}}},y=async(e,r={})=>{const{fallbackToAddress:s=!0}=r,t=r.ttl??36e5,a=`${e}:${String(s)}`;if(r.cache){const n=await r.cache.get(a);if(n!==void 0)return n}const i=await g(e,s);return r.cache&&await r.cache.set(a,i,t),i};export{y as checkMxRecords,y as default};
1
+ import{createRequire as f}from"node:module";let h;const v=e=>(h??=f(import.meta.url))(e),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[r,t]=n.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return n.getBuiltinModule(e)}return v(e)},{resolveMx:g,resolve4:y,resolve6:_}=p("node:dns/promises"),m=new Set(["EAI_AGAIN","ECONNREFUSED","EREFUSED","ESERVFAIL","ETIMEDOUT","ETIMEOUT"]),E=e=>{const{code:r}=e??{};return r!==void 0&&m.has(r)},l=async e=>{try{if((await y(e)).length>0)return!0}catch{}try{return(await _(e)).length>0}catch{return!1}},u=e=>({domainResolves:!0,records:[{exchange:e,priority:0}],resolvedVia:"address",valid:!0}),w=async(e,r)=>{try{const t=(await g(e)).map(o=>({exchange:o.exchange,priority:o.priority}));return t.length>0?{domainResolves:!0,records:t.toSorted((o,s)=>o.priority-s.priority),resolvedVia:"mx",valid:!0}:r&&await l(e)?u(e):{domainResolves:!1,records:[],resolvedVia:"none",valid:!1}}catch(t){return r&&await l(e)?u(e):{deferred:E(t),domainResolves:!1,error:t instanceof Error?t.message:String(t),resolvedVia:"none",valid:!1}}},i=new Map,M=async(e,r={})=>{const{fallbackToAddress:t=!0}=r,o=r.ttl??36e5,s=`${e}:${String(t)}`;if(r.cache){const a=await r.cache.get(s);if(a!==void 0)return a}const c=i.get(s);if(c)return c;const d=(async()=>{const a=await w(e,t);return r.cache&&!a.deferred&&await r.cache.set(s,a,o),a})();i.set(s,d);try{return await d}finally{i.delete(s)}};export{M as checkMxRecords,M as default};
@@ -1,41 +1,41 @@
1
1
  /**
2
- * Local-part prefixes that indicate a no-reply / do-not-reply mailbox.
3
- * These are a strict subset of {@link ROLE_ACCOUNT_PREFIXES}.
4
- */
2
+ * Local-part prefixes that indicate a no-reply / do-not-reply mailbox.
3
+ * These are a strict subset of {@link ROLE_ACCOUNT_PREFIXES}.
4
+ */
5
5
  declare const NO_REPLY_PREFIXES: ReadonlySet<string>;
6
6
  /**
7
- * Local-part prefixes that identify a role-based (shared, function) mailbox
8
- * rather than a personal one. Superset of RFC 2142 plus common real-world roles.
9
- */
7
+ * Local-part prefixes that identify a role-based (shared, function) mailbox
8
+ * rather than a personal one. Superset of RFC 2142 plus common real-world roles.
9
+ */
10
10
  declare const ROLE_ACCOUNT_PREFIXES: ReadonlySet<string>;
11
11
  /**
12
- * Determines whether an email address is a role-based account.
13
- *
14
- * Matches the whole local part, the part before any `+tag`, and each
15
- * dot/dash/underscore-separated token (so `sales.john`, `info+news`, and
16
- * `no-reply` are all caught).
17
- * @param email The email address to check.
18
- * @param customPrefixes Optional additional role prefixes to recognize.
19
- * @returns True when the address is a role account.
20
- * @example
21
- * ```ts
22
- * import { isRoleAccount } from "@visulima/email-verifier/checks/role";
23
- *
24
- * isRoleAccount("info@example.com"); // true
25
- * isRoleAccount("john.doe@example.com"); // false
26
- * ```
27
- */
12
+ * Determines whether an email address is a role-based account.
13
+ *
14
+ * Matches the whole local part, the part before any `+tag`, and each
15
+ * dot/dash/underscore-separated token (so `sales.john`, `info+news`, and
16
+ * `no-reply` are all caught).
17
+ * @param email The email address to check.
18
+ * @param customPrefixes Optional additional role prefixes to recognize.
19
+ * @returns True when the address is a role account.
20
+ * @example
21
+ * ```ts
22
+ * import { isRoleAccount } from "@visulima/email-verifier/checks/role";
23
+ *
24
+ * isRoleAccount("info@example.com"); // true
25
+ * isRoleAccount("john.doe@example.com"); // false
26
+ * ```
27
+ */
28
28
  declare const isRoleAccount: (email: string, customPrefixes?: Iterable<string>) => boolean;
29
29
  /**
30
- * Determines whether an email address is a no-reply / do-not-reply mailbox.
31
- * @param email The email address to check.
32
- * @returns True when the address is a no-reply mailbox.
33
- * @example
34
- * ```ts
35
- * import { isNoReply } from "@visulima/email-verifier/checks/role";
36
- *
37
- * isNoReply("no-reply@example.com"); // true
38
- * ```
39
- */
30
+ * Determines whether an email address is a no-reply / do-not-reply mailbox.
31
+ * @param email The email address to check.
32
+ * @returns True when the address is a no-reply mailbox.
33
+ * @example
34
+ * ```ts
35
+ * import { isNoReply } from "@visulima/email-verifier/checks/role";
36
+ *
37
+ * isNoReply("no-reply@example.com"); // true
38
+ * ```
39
+ */
40
40
  declare const isNoReply: (email: string) => boolean;
41
41
  export { NO_REPLY_PREFIXES, ROLE_ACCOUNT_PREFIXES, isRoleAccount as default, isNoReply, isRoleAccount };
@@ -1 +1 @@
1
- import{splitAddress as c}from"../packem_shared/extractDomain-CYJf1_0N.js";const l=new Set(["do-not-reply","do_not_reply","donotreply","no-reply","no_reply","noreply","notification","notifications","notify"]),n=new Set(["abuse","accounting","accounts","admin","administrator","all","billing","board","career","careers","ceo","cfo","compliance","contact","contacts","cto","customercare","customerservice","dev","developer","devnull","do-not-reply","do_not_reply","donotreply","enquiries","enquiry","everyone","feedback","finance","ftp","hello","help","helpdesk","hi","hostmaster","hr","info","information","inquiries","inquiry","investor","investors","it","jobs","legal","list","list-request","mail","mailer-daemon","mailerdaemon","majordomo","marketing","media","members","newsletter","no-reply","no_reply","noc","noreply","notification","notifications","notify","office","operations","order","orders","postmaster","press","privacy","purchasing","recruitment","register","registration","root","sales","secretary","security","service","services","shop","spam","staff","subscribe","support","sysadmin","team","tech","test","unsubscribe","usenet","uucp","webmaster","welcome","www"]),u=/[.\-_+]/,o=(t,e,r)=>{if(e.has(t))return!0;if(r){for(const s of r)if(s.toLowerCase()===t)return!0}return!1},m=(t,e)=>{const r=c(t);if(!r)return!1;const{localPart:s}=r,i=s.split("+")[0];if(o(s,n,e)||o(i,n,e))return!0;const a=i.split(u).filter(Boolean);return a.length>1&&a.some(p=>o(p,n,e))},d=t=>{const e=c(t);if(!e)return!1;const r=e.localPart.split("+")[0];return o(e.localPart,l)||o(r,l)};export{l as NO_REPLY_PREFIXES,n as ROLE_ACCOUNT_PREFIXES,m as default,d as isNoReply,m as isRoleAccount};
1
+ import{splitAddress as m}from"../packem_shared/extractDomain-CYJf1_0N.js";const p=new Set(["do-not-reply","do_not_reply","donotreply","no-reply","no_reply","noreply","notification","notifications","notify"]),i=new Set(["abuse","accounting","accounts","admin","administrator","all","billing","board","career","careers","ceo","cfo","compliance","contact","contacts","cto","customercare","customerservice","dev","developer","devnull","do-not-reply","do_not_reply","donotreply","enquiries","enquiry","everyone","feedback","finance","ftp","hello","help","helpdesk","hi","hostmaster","hr","info","information","inquiries","inquiry","investor","investors","it","jobs","legal","list","list-request","mail","mailer-daemon","mailerdaemon","majordomo","marketing","media","members","newsletter","no-reply","no_reply","noc","noreply","notification","notifications","notify","office","operations","order","orders","postmaster","press","privacy","purchasing","recruitment","register","registration","root","sales","secretary","security","service","services","shop","spam","staff","subscribe","support","sysadmin","team","tech","test","unsubscribe","usenet","uucp","webmaster","welcome","www"]),u=/[.\-_+]/,t=(o,e,r)=>e.has(o)||(r?.has(o)??!1),f=(o,e)=>{const r=m(o);if(!r)return!1;const{localPart:a}=r,l=a.split("+")[0],s=e?new Set([...e].map(n=>n.toLowerCase())):void 0;if(t(a,i,s)||t(l,i,s))return!0;const c=l.split(u).filter(Boolean);return c.length>1&&c.some(n=>t(n,i,s))},y=o=>{const e=m(o);if(!e)return!1;const r=e.localPart.split("+")[0];return t(e.localPart,p)||t(r,p)};export{p as NO_REPLY_PREFIXES,i as ROLE_ACCOUNT_PREFIXES,f as default,y as isNoReply,f as isRoleAccount};
@@ -1,43 +1,43 @@
1
- import { b as MxCheckResult, C as Cache, c as MxRecord } from "../packem_shared/mx.d-NAesS5sg.js";
1
+ import { b as MxCheckResult, C as Cache, c as MxRecord } from "../packem_shared/mx.d-HxIDdxvR.js";
2
2
  /**
3
- * Options for SMTP verification.
4
- */
3
+ * Options for SMTP verification.
4
+ */
5
5
  interface SmtpVerificationOptions {
6
6
  /** Cache for the underlying MX lookup. */
7
7
  cache?: Cache<MxCheckResult>;
8
8
  /**
9
- * Number of random, almost-certainly-nonexistent addresses to probe for
10
- * catch-all detection. More probes reduce false positives from
11
- * deferred-rejection servers. Set to 0 to disable.
12
- * @default 1
13
- */
9
+ * Number of random, almost-certainly-nonexistent addresses to probe for
10
+ * catch-all detection. More probes reduce false positives from
11
+ * deferred-rejection servers. Set to 0 to disable.
12
+ * @default 1
13
+ */
14
14
  catchAllProbes?: number;
15
15
  /**
16
- * MAIL FROM address used during the probe; defaults to `verify@` followed by
17
- * the HELO host.
18
- */
16
+ * MAIL FROM address used during the probe; defaults to `verify@` followed by
17
+ * the HELO host.
18
+ */
19
19
  fromEmail?: string;
20
20
  /**
21
- * HELO/EHLO hostname presented to the remote server.
22
- * @default the address domain
23
- */
21
+ * HELO/EHLO hostname presented to the remote server.
22
+ * @default the address domain
23
+ */
24
24
  heloHost?: string;
25
25
  /**
26
- * Pre-resolved MX records to probe, in priority order. When provided, the
27
- * probe skips its own DNS lookup — the orchestrator passes the records it
28
- * already resolved so the domain is not queried twice.
29
- */
26
+ * Pre-resolved MX records to probe, in priority order. When provided, the
27
+ * probe skips its own DNS lookup — the orchestrator passes the records it
28
+ * already resolved so the domain is not queried twice.
29
+ */
30
30
  mxRecords?: MxRecord[];
31
31
  port?: number;
32
32
  /**
33
- * Number of times to retry the whole probe on a temporary (greylist) failure.
34
- * @default 1
35
- */
33
+ * Number of times to retry the whole probe on a temporary (greylist) failure.
34
+ * @default 1
35
+ */
36
36
  retries?: number;
37
37
  /**
38
- * Delay in milliseconds between greylist retries.
39
- * @default 5000
40
- */
38
+ * Delay in milliseconds between greylist retries.
39
+ * @default 5000
40
+ */
41
41
  retryDelay?: number;
42
42
  /** Cache for SMTP results. */
43
43
  smtpCache?: Cache<SmtpVerificationResult>;
@@ -45,8 +45,8 @@ interface SmtpVerificationOptions {
45
45
  ttl?: number;
46
46
  }
47
47
  /**
48
- * Detailed result of an SMTP verification attempt.
49
- */
48
+ * Detailed result of an SMTP verification attempt.
49
+ */
50
50
  interface SmtpVerificationResult {
51
51
  /** True when the server accepts a random, nonexistent recipient (catch-all). */
52
52
  acceptAll?: boolean;
@@ -64,30 +64,5 @@ interface SmtpVerificationResult {
64
64
  /** True when the real RCPT TO was accepted (250). */
65
65
  valid: boolean;
66
66
  }
67
- /**
68
- * Verifies an email address over SMTP without sending a message.
69
- *
70
- * Performs the full handshake (greeting → EHLO/HELO → MAIL FROM → RCPT TO),
71
- * then — when the real recipient is accepted — issues additional RCPT TO probes
72
- * for random addresses to detect catch-all (accept-all) servers. Temporary
73
- * (4xx) failures are surfaced as `deferred` and retried up to `retries` times to
74
- * survive greylisting, and over-quota responses set `mailboxFull`.
75
- *
76
- * Note: many networks block outbound port 25 and many servers refuse or tarpit
77
- * verification probes, so treat a `deferred`/errored result as inconclusive
78
- * rather than undeliverable.
79
- * @param email The email address to verify.
80
- * @param options Verification options.
81
- * @returns The detailed SMTP verification result.
82
- * @example
83
- * ```ts
84
- * import { verifySmtp } from "@visulima/email-verifier/checks/smtp";
85
- *
86
- * const result = await verifySmtp("user@example.com", { catchAllProbes: 2 });
87
- * if (result.valid && !result.acceptAll) {
88
- * console.log("Mailbox exists");
89
- * }
90
- * ```
91
- */
92
67
  declare const verifySmtp: (email: string, options?: SmtpVerificationOptions) => Promise<SmtpVerificationResult>;
93
68
  export { type SmtpVerificationOptions, type SmtpVerificationResult, verifySmtp as default, verifySmtp };
@@ -1,7 +1,7 @@
1
- import{createRequire as x}from"node:module";import{splitAddress as M}from"../packem_shared/extractDomain-CYJf1_0N.js";import{checkMxRecords as j}from"./mx.js";const $=x(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=r=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(r)}return $(r)},{Socket:T}=R("node:net"),y=/[\u0000-\u001F\u007F]/,k=/\b([245]\.\d{1,3}\.\d{1,3})\b/,C=/^(\d{3})(?: |$)/,E=/\r?\n/,g="abcdefghijklmnopqrstuvwxyz0123456789",P=(r=20)=>{let e="";for(let t=0;t<r;t+=1)e+=g[Math.floor(Math.random()*g.length)]??"";return e},S=async r=>new Promise(e=>{setTimeout(e,r)});class _{transcript="";buffer="";completed=[];failure;finished=!1;socket;waiter;constructor(e){this.socket=e,e.on("data",o=>{this.transcript+=o.toString(),this.buffer+=o.toString(),this.drain()});const t=o=>{this.finished=!0,this.failure=o??new Error("Connection closed by server"),this.completed.length===0&&this.waiter&&(this.waiter.reject(this.failure),this.waiter=void 0)};e.on("error",t),e.on("close",()=>{t()}),e.on("timeout",()=>{t(new Error("SMTP socket timeout")),e.destroy()})}async command(e){return this.transcript+=`${e}\r
1
+ import{createRequire as x}from"node:module";import{splitAddress as L}from"../packem_shared/extractDomain-CYJf1_0N.js";import{checkMxRecords as _}from"./mx.js";let R;const M=r=>(R??=x(import.meta.url))(r),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=r=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,t]=m.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return m.getBuiltinModule(r)}return M(r)},{Socket:j}=T("node:net"),b=/[\u0000-\u001F\u007F]/,k=/\b([245]\.\d{1,3}\.\d{1,3})\b/,C=/^(\d{3})(?: |$)/,E=/\r?\n/,$="abcdefghijklmnopqrstuvwxyz0123456789",P=(r=20)=>{let e="";for(let t=0;t<r;t+=1)e+=$[Math.floor(Math.random()*$.length)]??"";return e},S=async r=>new Promise(e=>{setTimeout(e,r)});class A{transcript="";buffer="";completed=[];failure;finished=!1;socket;waiter;constructor(e){this.socket=e,e.on("data",s=>{this.transcript+=s.toString(),this.buffer+=s.toString(),this.drain()});const t=s=>{this.finished=!0,this.failure=s??new Error("Connection closed by server"),this.completed.length===0&&this.waiter&&(this.waiter.reject(this.failure),this.waiter=void 0)};e.on("error",t),e.on("close",()=>{t()}),e.on("timeout",()=>{t(new Error("SMTP socket timeout")),e.destroy()})}async command(e){return this.transcript+=`${e}\r
2
2
  `,this.socket.write(`${e}\r
3
3
  `),this.readReply()}close(){try{this.socket.write(`QUIT\r
4
- `)}catch{}this.socket.removeAllListeners(),this.socket.destroy()}async readReply(){if(this.completed.length>0)return this.completed.shift();if(this.finished)throw this.failure??new Error("Connection closed");return new Promise((e,t)=>{this.waiter={reject:t,resolve:e}})}drain(){const e=this.buffer.split(E);this.buffer=e.pop()??"";let t=[];for(const o of e){t.push(o);const a=C.exec(o);if(a){const i=t.join(`
5
- `),c=k.exec(i)?.[1];this.completed.push({code:Number.parseInt(a[1],10),enhanced:c,text:i}),t=[]}}if(t.length>0&&(this.buffer=`${t.join(`
4
+ `)}catch{}this.socket.removeAllListeners(),this.socket.destroy()}async readReply(){if(this.completed.length>0)return this.completed.shift();if(this.finished)throw this.failure??new Error("Connection closed");return new Promise((e,t)=>{this.waiter={reject:t,resolve:e}})}drain(){const e=this.buffer.split(E);this.buffer=e.pop()??"";let t=[];for(const s of e){t.push(s);const c=C.exec(s);if(c){const o=t.join(`
5
+ `),l=k.exec(o)?.[1];this.completed.push({code:Number.parseInt(c[1],10),enhanced:l,text:o}),t=[]}}if(t.length>0&&(this.buffer=`${t.join(`
6
6
  `)}
7
- ${this.buffer}`),this.waiter&&this.completed.length>0){const{resolve:o}=this.waiter;this.waiter=void 0,o(this.completed.shift())}}}const A=r=>{const{code:e,enhanced:t}=r;return e>=200&&e<300?{code:e,enhancedCode:t,valid:!0}:e===452||e===552||t==="4.2.2"||t==="5.2.2"?{code:e,deferred:e===452,enhancedCode:t,mailboxFull:!0,valid:!1}:e>=400&&e<500?{code:e,deferred:!0,enhancedCode:t,valid:!1}:{code:e,enhancedCode:t,valid:!1}},L=async(r,e,t)=>new Promise((o,a)=>{const i=new T;i.setTimeout(t);const c=f=>{i.removeAllListeners(),i.destroy(),a(f)},l=()=>{c(new Error("SMTP connection timeout"))};i.once("error",c),i.once("timeout",l),i.connect(e,r,()=>{i.removeListener("error",c),i.removeListener("timeout",l),o(new _(i))})}),H=async(r,e,t,o)=>{const{catchAllProbes:a=1,port:i=25,timeout:c=5e3}=o,l=o.heloHost??e,f=o.fromEmail??`verify@${l}`;let n;try{n=await L(t.exchange,i,c);const d=await n.readReply();if(d.code!==220)return{deferred:!0,error:`Unexpected greeting: ${d.text}`,valid:!1};let s=await n.command(`EHLO ${l}`);if(s.code!==250&&(s=await n.command(`HELO ${l}`),s.code!==250))return{deferred:!0,error:`HELO rejected: ${s.text}`,valid:!1};const u=await n.command(`MAIL FROM:<${f}>`);if(u.code!==250)return{deferred:!0,error:`MAIL FROM rejected: ${u.text}`,valid:!1};const b=await n.command(`RCPT TO:<${r}>`),p=A(b);let m;if(p.valid&&a>0){m=!0;for(let v=0;v<a;v+=1){const w=await n.command(`RCPT TO:<${P()}@${e}>`);if(w.code<200||w.code>=300){m=!1;break}}}return{...p,acceptAll:m,smtpResponse:n.transcript}}finally{n?.close()}},O=async(r,e,t,o)=>{let a="SMTP verification did not complete";for(const i of t)try{return await H(r,e,i,o)}catch(c){a=c instanceof Error?c.message:String(c)}return{deferred:!0,error:a,valid:!1}},I=r=>{if(r.heloHost!==void 0&&y.test(r.heloHost))return{error:"Invalid heloHost: control characters are not allowed",valid:!1};if(r.fromEmail!==void 0&&y.test(r.fromEmail))return{error:"Invalid fromEmail: control characters are not allowed",valid:!1}},B=async(r,e={})=>{const t=M(r);if(!t)return{error:"Invalid email format",valid:!1};const{domain:o}=t,a=I(e);if(a)return a;const{retries:i=1,retryDelay:c=5e3,ttl:l=36e5}=e,f=["smtp",t.address,e.fromEmail??"",String(e.port??25),e.heloHost??"",String(e.catchAllProbes??1),(e.mxRecords??[]).map(s=>s.exchange).join(",")].join("|");if(e.smtpCache){const s=await e.smtpCache.get(f);if(s!==void 0)return s}let n=e.mxRecords;if(!n||n.length===0){const s=await j(o,{cache:e.cache,fallbackToAddress:!1});if(!s.valid||!s.records||s.records.length===0)return{error:s.error??"No MX records found",mxRecords:s.records,valid:!1};n=s.records}let d={error:"SMTP verification did not complete",valid:!1};for(let s=0;s<=i&&(d=await O(t.address,o,n,e),!(!d.deferred||s===i));s+=1)await S(c);return d={...d,mxRecords:n},e.smtpCache&&!d.deferred&&await e.smtpCache.set(f,d,l),d};export{B as default,B as verifySmtp};
7
+ ${this.buffer}`),this.waiter&&this.completed.length>0){const{resolve:s}=this.waiter;this.waiter=void 0,s(this.completed.shift())}}}const H=r=>{const{code:e,enhanced:t}=r;return e>=200&&e<300?{code:e,enhancedCode:t,valid:!0}:e===452||e===552||t==="4.2.2"||t==="5.2.2"?{code:e,deferred:e===452,enhancedCode:t,mailboxFull:!0,valid:!1}:e>=400&&e<500?{code:e,deferred:!0,enhancedCode:t,valid:!1}:{code:e,enhancedCode:t,valid:!1}},O=async(r,e,t)=>new Promise((s,c)=>{const o=new j;o.setTimeout(t);const l=a=>{o.removeAllListeners(),o.destroy(),c(a)},i=()=>{l(new Error("SMTP connection timeout"))};o.once("error",l),o.once("timeout",i),o.connect(e,r,()=>{o.removeListener("error",l),o.removeListener("timeout",i),s(new A(o))})}),I=async(r,e,t,s)=>{const{catchAllProbes:c=1,port:o=25,timeout:l=5e3}=s,i=s.heloHost??e,a=s.fromEmail??`verify@${i}`;let d;try{d=await O(t.exchange,o,l);const u=await d.readReply();if(u.code!==220)return{connectionLevel:!0,deferred:!0,error:`Unexpected greeting: ${u.text}`,valid:!1};let n=await d.command(`EHLO ${i}`);if(n.code!==250&&(n=await d.command(`HELO ${i}`),n.code!==250))return{connectionLevel:!0,deferred:!0,error:`HELO rejected: ${n.text}`,valid:!1};const h=await d.command(`MAIL FROM:<${a}>`);if(h.code!==250)return{connectionLevel:!0,deferred:!0,error:`MAIL FROM rejected: ${h.text}`,valid:!1};const f=await d.command(`RCPT TO:<${r}>`),w=H(f);let p;if(w.valid&&c>0){p=!0;for(let y=0;y<c;y+=1){const g=await d.command(`RCPT TO:<${P()}@${e}>`);if(g.code<200||g.code>=300){p=!1;break}}}return{...w,acceptAll:p,smtpResponse:d.transcript}}finally{d?.close()}},q=async(r,e,t,s)=>{let c="SMTP verification did not complete",o;for(const l of t){let i;try{i=await I(r,e,l,s)}catch(a){c=a instanceof Error?a.message:String(a);continue}if(i.connectionLevel){o=i;continue}return i}if(o){const{connectionLevel:l,...i}=o;return i}return{deferred:!0,error:c,valid:!1}},F=r=>{if(r.heloHost!==void 0&&b.test(r.heloHost))return{error:"Invalid heloHost: control characters are not allowed",valid:!1};if(r.fromEmail!==void 0&&b.test(r.fromEmail))return{error:"Invalid fromEmail: control characters are not allowed",valid:!1}},v=new Map,z=async(r,e={})=>{const t=L(r);if(!t)return{error:"Invalid email format",valid:!1};const{domain:s}=t,c=F(e);if(c)return c;const{retries:o=1,retryDelay:l=5e3,ttl:i=36e5}=e,a=["smtp",t.address,e.fromEmail??"",String(e.port??25),e.heloHost??"",String(e.catchAllProbes??1),(e.mxRecords??[]).map(n=>n.exchange).join(",")].join("|");if(e.smtpCache){const n=await e.smtpCache.get(a);if(n!==void 0)return n}const d=v.get(a);if(d)return d;const u=(async()=>{let n=e.mxRecords;if(!n||n.length===0){const f=await _(s,{cache:e.cache,fallbackToAddress:!1});if(!f.valid||!f.records||f.records.length===0)return{error:f.error??"No MX records found",mxRecords:f.records,valid:!1};n=f.records}let h={error:"SMTP verification did not complete",valid:!1};for(let f=0;f<=o&&(h=await q(t.address,s,n,e),!(!h.deferred||f===o));f+=1)await S(l);return h={...h,mxRecords:n},e.smtpCache&&!h.deferred&&await e.smtpCache.set(a,h,i),h})();v.set(a,u);try{return await u}finally{v.delete(a)}};export{z as default,z as verifySmtp};
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The result of symbol / Unicode analysis.
3
- */
2
+ * The result of symbol / Unicode analysis.
3
+ */
4
4
  interface SymbolResult {
5
5
  /** True when the address mixes Unicode scripts (a homoglyph-spoofing signal). */
6
6
  hasMixedScripts: boolean;
@@ -12,18 +12,18 @@ interface SymbolResult {
12
12
  scripts: string[];
13
13
  }
14
14
  /**
15
- * Detects symbols, emoji, and mixed Unicode scripts in an email address.
16
- *
17
- * Mixed-script local parts (e.g. Latin + Cyrillic) are a classic homoglyph /
18
- * spoofing signal; symbol or emoji characters indicate a non-standard address.
19
- * @param email The email address to analyze.
20
- * @returns The symbol analysis result.
21
- * @example
22
- * ```ts
23
- * import { analyzeSymbols } from "@visulima/email-verifier/checks/symbol";
24
- *
25
- * analyzeSymbols("раypal@example.com").hasMixedScripts; // true (Cyrillic "ра")
26
- * ```
27
- */
15
+ * Detects symbols, emoji, and mixed Unicode scripts in an email address.
16
+ *
17
+ * Mixed-script local parts (e.g. Latin + Cyrillic) are a classic homoglyph /
18
+ * spoofing signal; symbol or emoji characters indicate a non-standard address.
19
+ * @param email The email address to analyze.
20
+ * @returns The symbol analysis result.
21
+ * @example
22
+ * ```ts
23
+ * import { analyzeSymbols } from "@visulima/email-verifier/checks/symbol";
24
+ *
25
+ * analyzeSymbols("раypal@example.com").hasMixedScripts; // true (Cyrillic "ра")
26
+ * ```
27
+ */
28
28
  declare const analyzeSymbols: (email: string) => SymbolResult;
29
29
  export { type SymbolResult, analyzeSymbols, analyzeSymbols as default };
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Validates an email address format according to basic RFC standards.
3
- *
4
- * This is intentionally pragmatic rather than a full RFC 5322 parser: it rejects
5
- * the address shapes that never deliver (missing parts, consecutive dots, leading
6
- * or trailing dots, hyphen-bounded domain labels) while accepting the long tail
7
- * of legitimate real-world addresses.
8
- * @param email The email address string to validate.
9
- * @returns True if the email address is syntactically valid, false otherwise.
10
- * @example
11
- * ```ts
12
- * import { validateSyntax } from "@visulima/email-verifier/checks/syntax";
13
- *
14
- * validateSyntax("user@example.com"); // true
15
- * validateSyntax("user@@example.com"); // false
16
- * ```
17
- */
2
+ * Validates an email address format according to basic RFC standards.
3
+ *
4
+ * This is intentionally pragmatic rather than a full RFC 5322 parser: it rejects
5
+ * the address shapes that never deliver (missing parts, consecutive dots, leading
6
+ * or trailing dots, hyphen-bounded domain labels) while accepting the long tail
7
+ * of legitimate real-world addresses.
8
+ * @param email The email address string to validate.
9
+ * @returns True if the email address is syntactically valid, false otherwise.
10
+ * @example
11
+ * ```ts
12
+ * import { validateSyntax } from "@visulima/email-verifier/checks/syntax";
13
+ *
14
+ * validateSyntax("user@example.com"); // true
15
+ * validateSyntax("user@@example.com"); // false
16
+ * ```
17
+ */
18
18
  declare const validateSyntax: (email: string) => boolean;
19
19
  export { validateSyntax as default, validateSyntax };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The result of sub-address (tag) detection.
3
- */
2
+ * The result of sub-address (tag) detection.
3
+ */
4
4
  interface TagResult {
5
5
  /** The local part with the tag and separator removed (the "real" mailbox). */
6
6
  baseLocalPart: string;
@@ -12,20 +12,20 @@ interface TagResult {
12
12
  tag?: string;
13
13
  }
14
14
  /**
15
- * Detects plus-addressing / sub-addressing tags in an email address.
16
- *
17
- * Most providers (Gmail, Outlook, iCloud, Proton, …) delimit the tag with `+`;
18
- * a few (Fastmail, Yahoo) use `-`. The returned {@link TagResult.baseLocalPart}
19
- * is the canonical mailbox with the tag stripped.
20
- * @param email The email address to inspect.
21
- * @returns The tag detection result.
22
- * @example
23
- * ```ts
24
- * import { detectTag } from "@visulima/email-verifier/checks/tag";
25
- *
26
- * detectTag("user+newsletter@gmail.com");
27
- * // { hasTag: true, tag: "newsletter", separator: "+", baseLocalPart: "user" }
28
- * ```
29
- */
15
+ * Detects plus-addressing / sub-addressing tags in an email address.
16
+ *
17
+ * Most providers (Gmail, Outlook, iCloud, Proton, …) delimit the tag with `+`;
18
+ * a few (Fastmail, Yahoo) use `-`. The returned {@link TagResult.baseLocalPart}
19
+ * is the canonical mailbox with the tag stripped.
20
+ * @param email The email address to inspect.
21
+ * @returns The tag detection result.
22
+ * @example
23
+ * ```ts
24
+ * import { detectTag } from "@visulima/email-verifier/checks/tag";
25
+ *
26
+ * detectTag("user+newsletter@gmail.com");
27
+ * // { hasTag: true, tag: "newsletter", separator: "+", baseLocalPart: "user" }
28
+ * ```
29
+ */
30
30
  declare const detectTag: (email: string) => TagResult;
31
31
  export { type TagResult, detectTag as default, detectTag };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * A name parsed from an email's local part.
3
- */
2
+ * A name parsed from an email's local part.
3
+ */
4
4
  interface NameResult {
5
5
  /** Confidence in the parse: `high` (clear separator), `medium` (camelCase), `low` (heuristic), `none`. */
6
6
  confidence: "high" | "low" | "medium" | "none";
@@ -12,21 +12,21 @@ interface NameResult {
12
12
  lastName?: string;
13
13
  }
14
14
  /**
15
- * Heuristically parses a person's name from the local part of an email address.
16
- *
17
- * Handles separator-delimited (`john.doe`), camelCase (`johnDoe`), and
18
- * single-token local parts, stripping trailing digits. This is best-effort name
19
- * parsing only — no gender detection — and confidence is reported so callers
20
- * can decide how much to trust it.
21
- * @param email The email address to parse.
22
- * @returns The parsed name and a confidence level.
23
- * @example
24
- * ```ts
25
- * import { parseName } from "@visulima/email-verifier/enrich/name";
26
- *
27
- * parseName("john.doe@example.com");
28
- * // { firstName: "John", lastName: "Doe", fullName: "John Doe", confidence: "high" }
29
- * ```
30
- */
15
+ * Heuristically parses a person's name from the local part of an email address.
16
+ *
17
+ * Handles separator-delimited (`john.doe`), camelCase (`johnDoe`), and
18
+ * single-token local parts, stripping trailing digits. This is best-effort name
19
+ * parsing only — no gender detection — and confidence is reported so callers
20
+ * can decide how much to trust it.
21
+ * @param email The email address to parse.
22
+ * @returns The parsed name and a confidence level.
23
+ * @example
24
+ * ```ts
25
+ * import { parseName } from "@visulima/email-verifier/enrich/name";
26
+ *
27
+ * parseName("john.doe@example.com");
28
+ * // { firstName: "John", lastName: "Doe", fullName: "John Doe", confidence: "high" }
29
+ * ```
30
+ */
31
31
  declare const parseName: (email: string) => NameResult;
32
32
  export { type NameResult, parseName as default, parseName };
@@ -1,9 +1,9 @@
1
1
  import { MxProviderInfo } from '@visulima/email-provider-mx';
2
2
  export { type MxProviderInfo, classifyMx, classifyMxRecords, isSecureEmailGateway } from '@visulima/email-provider-mx';
3
- import { c as MxRecord, b as MxCheckResult, C as Cache } from "../packem_shared/mx.d-NAesS5sg.js";
3
+ import { c as MxRecord, b as MxCheckResult, C as Cache } from "../packem_shared/mx.d-HxIDdxvR.js";
4
4
  /**
5
- * The enriched provider details for an email address.
6
- */
5
+ * The enriched provider details for an email address.
6
+ */
7
7
  interface ProviderDetails {
8
8
  /** True when the resolving MX is a Secure Email Gateway (Proofpoint, Mimecast, …). */
9
9
  isSecureEmailGateway: boolean;
@@ -13,28 +13,28 @@ interface ProviderDetails {
13
13
  provider?: MxProviderInfo;
14
14
  }
15
15
  /**
16
- * Options for provider enrichment.
17
- */
16
+ * Options for provider enrichment.
17
+ */
18
18
  interface ProviderEnrichOptions {
19
19
  cache?: Cache<MxCheckResult>;
20
20
  ttl?: number;
21
21
  }
22
22
  /**
23
- * Resolves an email address's mailbox/SEG provider from its MX records.
24
- *
25
- * Looks up the domain's MX records, then classifies the highest-priority host
26
- * via `@visulima/email-provider-mx` — emailable's "SMTP Provider Details" plus
27
- * Secure-Email-Gateway detection.
28
- * @param email The email address to enrich.
29
- * @param options Caching options for the MX lookup.
30
- * @returns The provider details, including the MX records used.
31
- * @example
32
- * ```ts
33
- * import { enrichProvider } from "@visulima/email-verifier/enrich/provider";
34
- *
35
- * const details = await enrichProvider("user@gmail.com");
36
- * console.log(details.provider?.display); // "Google"
37
- * ```
38
- */
23
+ * Resolves an email address's mailbox/SEG provider from its MX records.
24
+ *
25
+ * Looks up the domain's MX records, then classifies the highest-priority host
26
+ * via `@visulima/email-provider-mx` — emailable's "SMTP Provider Details" plus
27
+ * Secure-Email-Gateway detection.
28
+ * @param email The email address to enrich.
29
+ * @param options Caching options for the MX lookup.
30
+ * @returns The provider details, including the MX records used.
31
+ * @example
32
+ * ```ts
33
+ * import { enrichProvider } from "@visulima/email-verifier/enrich/provider";
34
+ *
35
+ * const details = await enrichProvider("user@gmail.com");
36
+ * console.log(details.provider?.display); // "Google"
37
+ * ```
38
+ */
39
39
  declare const enrichProvider: (email: string, options?: ProviderEnrichOptions) => Promise<ProviderDetails>;
40
40
  export { type ProviderDetails, type ProviderEnrichOptions, enrichProvider as default, enrichProvider };