@bitclaw/disposable-email 1.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Chavez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @bitclaw/disposable-email
2
+
3
+ Email validation against disposable/temporary email providers with optional DNS MX record checking.
4
+
5
+ ## Features
6
+
7
+ - **Disposable domain blocklist** — ~680 known disposable email providers (hardcoded, zero network calls)
8
+ - **MX record validation** — Optional DNS lookup to verify the domain can receive mail
9
+ - **Fail-open DNS** — Transient DNS errors allow the request through (only blocks definitive failures)
10
+ - **Zero dependencies** — Uses Node.js built-in `dns/promises`
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ bun add @bitclaw/disposable-email
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```typescript
21
+ import { isDisposableEmail, validateEmailDomain } from '@bitclaw/disposable-email'
22
+
23
+ // Fast synchronous check against blocklist
24
+ isDisposableEmail('user@tempmail.com') // true
25
+ isDisposableEmail('user@gmail.com') // false
26
+
27
+ // Full validation with optional MX check
28
+ const result = await validateEmailDomain('user@example.com', { checkMx: true })
29
+ if (!result.valid) {
30
+ console.log(result.reason, result.message)
31
+ }
32
+ ```
33
+
34
+ ## API
35
+
36
+ ### `isDisposableEmail(email: string): boolean`
37
+
38
+ Synchronous check against the built-in blocklist. Returns `true` if the domain is a known disposable email provider.
39
+
40
+ ```typescript
41
+ isDisposableEmail('user@guerrillamail.com') // true
42
+ isDisposableEmail('user@company.com') // false
43
+ ```
44
+
45
+ ### `validateEmailDomain(email, options?): Promise<EmailValidationResult>`
46
+
47
+ Full domain validation pipeline:
48
+
49
+ 1. Extracts and validates the domain from the email
50
+ 2. Checks against the disposable domain blocklist
51
+ 3. Optionally verifies DNS MX records
52
+
53
+ ```typescript
54
+ const result = await validateEmailDomain('user@fake-domain.xyz', {
55
+ checkMx: true, // Enable MX record lookup (default: false)
56
+ dnsTimeout: 5000 // DNS timeout in ms (default: 5000)
57
+ })
58
+
59
+ if (!result.valid) {
60
+ // result.reason: 'disposable' | 'no-mx-records' | 'invalid-domain' | 'dns-error'
61
+ // result.message: Human-readable explanation
62
+ }
63
+ ```
64
+
65
+ ### Types
66
+
67
+ ```typescript
68
+ type EmailValidationResult = {
69
+ valid: boolean
70
+ reason?: 'disposable' | 'no-mx-records' | 'invalid-domain' | 'dns-error'
71
+ message?: string
72
+ }
73
+
74
+ type MxValidationOptions = {
75
+ checkMx?: boolean // Default: false
76
+ dnsTimeout?: number // Default: 5000
77
+ }
78
+ ```
79
+
80
+ ### `DISPOSABLE_DOMAINS: Set<string>`
81
+
82
+ The raw domain blocklist, exported for direct access if needed:
83
+
84
+ ```typescript
85
+ import { DISPOSABLE_DOMAINS } from '@bitclaw/disposable-email'
86
+
87
+ DISPOSABLE_DOMAINS.has('tempmail.com') // true
88
+ DISPOSABLE_DOMAINS.size // ~680
89
+ ```
90
+
91
+ ## DNS Error Handling
92
+
93
+ | DNS Result | Behavior |
94
+ |-----------|----------|
95
+ | MX records found | `{ valid: true }` |
96
+ | ENOTFOUND / ENODATA | `{ valid: false, reason: 'no-mx-records' }` |
97
+ | Timeout | `{ valid: false, reason: 'dns-error' }` |
98
+ | Other DNS error | `{ valid: true }` (fail-open) |
99
+
100
+ ## Testing
101
+
102
+ ```bash
103
+ bun test
104
+ ```
105
+
106
+ 13 tests across 2 files.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Curated set of disposable/temporary email domains.
3
+ * Sources: disposable-email-domains (GitHub), community contributions.
4
+ * Community can add more domains via PRs.
5
+ */
6
+ export declare const DISPOSABLE_DOMAINS: ReadonlySet<string>;
7
+ //# sourceMappingURL=domains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAqqB1B,CAAC"}
@@ -0,0 +1,683 @@
1
+ /**
2
+ * Curated set of disposable/temporary email domains.
3
+ * Sources: disposable-email-domains (GitHub), community contributions.
4
+ * Community can add more domains via PRs.
5
+ */
6
+ export const DISPOSABLE_DOMAINS = new Set([
7
+ '0-mail.com',
8
+ '0815.ru',
9
+ '0clickemail.com',
10
+ '10minutemail.com',
11
+ '10minutemail.net',
12
+ '10minutemail.org',
13
+ '123-m.com',
14
+ '1chuan.com',
15
+ '1pad.de',
16
+ '20minutemail.com',
17
+ '2prong.com',
18
+ '30minutemail.com',
19
+ '33mail.com',
20
+ '3d-painting.com',
21
+ '4warding.com',
22
+ '5ghgfhfghfgh.tk',
23
+ '60minutemail.com',
24
+ '675hosting.com',
25
+ '6url.com',
26
+ '75hosting.com',
27
+ '7tags.com',
28
+ '9ox.net',
29
+ 'a-bc.net',
30
+ 'agedmail.com',
31
+ 'amilegit.com',
32
+ 'anonbox.net',
33
+ 'anonmails.de',
34
+ 'anonymbox.com',
35
+ 'antichef.com',
36
+ 'antichef.net',
37
+ 'antireg.ru',
38
+ 'antispam.de',
39
+ 'antispammail.de',
40
+ 'armyspy.com',
41
+ 'baxomale.ht.cx',
42
+ 'beefmilk.com',
43
+ 'bigstring.com',
44
+ 'binkmail.com',
45
+ 'bio-muesli.net',
46
+ 'bobmail.info',
47
+ 'bodhi.lawlita.com',
48
+ 'bofthew.com',
49
+ 'bootybay.de',
50
+ 'boun.cr',
51
+ 'bouncr.com',
52
+ 'breakthru.com',
53
+ 'brefmail.com',
54
+ 'broadbandninja.com',
55
+ 'bsnow.net',
56
+ 'bugmenot.com',
57
+ 'bumpymail.com',
58
+ 'bund.us',
59
+ 'bundes-ede.de',
60
+ 'burnthespam.info',
61
+ 'buyusedlibrarybooks.org',
62
+ 'byom.de',
63
+ 'cachedot.net',
64
+ 'casualdx.com',
65
+ 'centermail.com',
66
+ 'centermail.net',
67
+ 'chammy.info',
68
+ 'cheatmail.de',
69
+ 'chogmail.com',
70
+ 'choicemail1.com',
71
+ 'clixser.com',
72
+ 'cmail.net',
73
+ 'cmail.org',
74
+ 'coldemail.info',
75
+ 'cool.fr.nf',
76
+ 'correo.blogos.net',
77
+ 'cosmorph.com',
78
+ 'courriel.fr.nf',
79
+ 'courrieltemporaire.com',
80
+ 'crazymailing.com',
81
+ 'cubiclink.com',
82
+ 'curryworld.de',
83
+ 'cust.in',
84
+ 'cuvox.de',
85
+ 'd3p.dk',
86
+ 'dacoolest.com',
87
+ 'daintly.com',
88
+ 'dandikmail.com',
89
+ 'dayrep.com',
90
+ 'deadaddress.com',
91
+ 'deadspam.com',
92
+ 'deekayen.us',
93
+ 'despam.it',
94
+ 'despammed.com',
95
+ 'devnullmail.com',
96
+ 'dfgh.net',
97
+ 'digitalsanctuary.com',
98
+ 'dingbone.com',
99
+ 'discard.email',
100
+ 'discardmail.com',
101
+ 'discardmail.de',
102
+ 'dispomail.eu',
103
+ 'disposable.cf',
104
+ 'disposable.ga',
105
+ 'disposable.ml',
106
+ 'disposableaddress.com',
107
+ 'disposableemailcheck.com',
108
+ 'disposableinbox.com',
109
+ 'dispose.it',
110
+ 'dispostable.com',
111
+ 'dodgeit.com',
112
+ 'dodgit.com',
113
+ 'dodgit.org',
114
+ 'dontreg.com',
115
+ 'dontsendmespam.de',
116
+ 'drdrb.com',
117
+ 'drdrb.net',
118
+ 'droplar.com',
119
+ 'dropmail.me',
120
+ 'duam.net',
121
+ 'dudmail.com',
122
+ 'dump-email.info',
123
+ 'dumpandjunk.com',
124
+ 'dumpmail.de',
125
+ 'dumpyemail.com',
126
+ 'e4ward.com',
127
+ 'easytrashmail.com',
128
+ 'einrot.com',
129
+ 'email60.com',
130
+ 'emaildienst.de',
131
+ 'emailgo.de',
132
+ 'emailigo.de',
133
+ 'emailinfive.com',
134
+ 'emaillime.com',
135
+ 'emailmiser.com',
136
+ 'emailondeck.com',
137
+ 'emailproxsy.com',
138
+ 'emails.ga',
139
+ 'emailsensei.com',
140
+ 'emailtemporario.com.br',
141
+ 'emailto.de',
142
+ 'emailwarden.com',
143
+ 'emailx.at.hm',
144
+ 'emailxfer.com',
145
+ 'emeil.in',
146
+ 'emeil.ir',
147
+ 'emz.net',
148
+ 'eonmech.com',
149
+ 'evopo.com',
150
+ 'explodemail.com',
151
+ 'express.net.ua',
152
+ 'eyepaste.com',
153
+ 'fakeinbox.com',
154
+ 'fakeinformation.com',
155
+ 'fakemail.fr',
156
+ 'fakemailz.com',
157
+ 'fammix.com',
158
+ 'fansworldwide.de',
159
+ 'fantasymail.de',
160
+ 'fastacura.com',
161
+ 'fastchevy.com',
162
+ 'fastchrysler.com',
163
+ 'fastkawasaki.com',
164
+ 'fastmazda.com',
165
+ 'fastmitsubishi.com',
166
+ 'fastnissan.com',
167
+ 'fastsubaru.com',
168
+ 'fastsuzuki.com',
169
+ 'fasttoyota.com',
170
+ 'fastyamaha.com',
171
+ 'filzmail.com',
172
+ 'fixmail.tk',
173
+ 'fizmail.com',
174
+ 'fleckens.hu',
175
+ 'flurred.com',
176
+ 'flyspam.com',
177
+ 'footard.com',
178
+ 'forgetmail.com',
179
+ 'fr33mail.info',
180
+ 'frapmail.com',
181
+ 'freundin.ru',
182
+ 'friendlymail.co.uk',
183
+ 'front14.org',
184
+ 'fuckingduh.com',
185
+ 'fudgerub.com',
186
+ 'fux0ringduh.com',
187
+ 'garliclife.com',
188
+ 'geronra.com',
189
+ 'get2mail.fr',
190
+ 'getairmail.com',
191
+ 'getmails.eu',
192
+ 'getnada.com',
193
+ 'getonemail.com',
194
+ 'getonemail.net',
195
+ 'ghosttexter.de',
196
+ 'giantmail.de',
197
+ 'girlsundertheinfluence.com',
198
+ 'gishpuppy.com',
199
+ 'goemailgo.com',
200
+ 'gorillaswithdirtyarmpits.com',
201
+ 'gotmail.net',
202
+ 'gotmail.org',
203
+ 'gotti.otherinbox.com',
204
+ 'great-host.in',
205
+ 'greensloth.com',
206
+ 'grr.la',
207
+ 'gsrv.co.uk',
208
+ 'guerillamail.biz',
209
+ 'guerillamail.com',
210
+ 'guerillamail.de',
211
+ 'guerillamail.info',
212
+ 'guerillamail.net',
213
+ 'guerillamail.org',
214
+ 'guerrillamail.biz',
215
+ 'guerrillamail.com',
216
+ 'guerrillamail.de',
217
+ 'guerrillamail.info',
218
+ 'guerrillamail.net',
219
+ 'guerrillamail.org',
220
+ 'guerrillamailblock.com',
221
+ 'gustr.com',
222
+ 'h8s6ohdrber.cf',
223
+ 'haltospam.com',
224
+ 'harakirimail.com',
225
+ 'hat-gansen.de',
226
+ 'hatespam.org',
227
+ 'herp.in',
228
+ 'hidemail.de',
229
+ 'hidzz.com',
230
+ 'hmamail.com',
231
+ 'hopemail.biz',
232
+ 'hotpop.com',
233
+ 'hulapla.de',
234
+ 'ieatspam.eu',
235
+ 'ieatspam.info',
236
+ 'ieh-mail.de',
237
+ 'ihateyoualot.info',
238
+ 'iheartspam.org',
239
+ 'imails.info',
240
+ 'inbax.tk',
241
+ 'inbox.si',
242
+ 'inboxalias.com',
243
+ 'inboxclean.com',
244
+ 'inboxclean.org',
245
+ 'incognitomail.com',
246
+ 'incognitomail.net',
247
+ 'incognitomail.org',
248
+ 'insorg-mail.info',
249
+ 'instant-mail.de',
250
+ 'internxt.com',
251
+ 'ipoo.org',
252
+ 'irish2me.com',
253
+ 'iwi.net',
254
+ 'jetable.com',
255
+ 'jetable.fr.nf',
256
+ 'jetable.net',
257
+ 'jetable.org',
258
+ 'jnxjn.com',
259
+ 'jourrapide.com',
260
+ 'junk1e.com',
261
+ 'junkmail.ga',
262
+ 'junkmail.gq',
263
+ 'kasmail.com',
264
+ 'kaspop.com',
265
+ 'keepmymail.com',
266
+ 'killmail.com',
267
+ 'killmail.net',
268
+ 'kingsq.ga',
269
+ 'klzlk.com',
270
+ 'kook.ml',
271
+ 'kurzepost.de',
272
+ 'lackmail.net',
273
+ 'lavabit.com',
274
+ 'letthemeatspam.com',
275
+ 'lhsdv.com',
276
+ 'lifebyfood.com',
277
+ 'link2mail.net',
278
+ 'litedrop.com',
279
+ 'lol.ovpn.to',
280
+ 'lookugly.com',
281
+ 'lopl.co.cc',
282
+ 'lortemail.dk',
283
+ 'lovemeleaveme.com',
284
+ 'lr78.com',
285
+ 'lroid.com',
286
+ 'lukop.dk',
287
+ 'm21.cc',
288
+ 'mail-hierarchie.de',
289
+ 'mail-temporaire.fr',
290
+ 'mail.by',
291
+ 'mail.mezimages.net',
292
+ 'mail.zp.ua',
293
+ 'mail2rss.org',
294
+ 'mail333.com',
295
+ 'mailbidon.com',
296
+ 'mailblocks.com',
297
+ 'mailbucket.org',
298
+ 'mailcat.biz',
299
+ 'mailcatch.com',
300
+ 'maildrop.cc',
301
+ 'maildrop.cf',
302
+ 'maildrop.ga',
303
+ 'maildrop.gq',
304
+ 'maildrop.ml',
305
+ 'maileater.com',
306
+ 'mailexpire.com',
307
+ 'mailfa.tk',
308
+ 'mailforspam.com',
309
+ 'mailfree.ga',
310
+ 'mailfree.gq',
311
+ 'mailfree.ml',
312
+ 'mailfreeonline.com',
313
+ 'mailguard.me',
314
+ 'mailimate.com',
315
+ 'mailin8r.com',
316
+ 'mailinater.com',
317
+ 'mailinator.com',
318
+ 'mailinator.gq',
319
+ 'mailinator.net',
320
+ 'mailinator.org',
321
+ 'mailinator.us',
322
+ 'mailinator2.com',
323
+ 'mailincubator.com',
324
+ 'mailismagic.com',
325
+ 'mailjunk.cf',
326
+ 'mailjunk.ga',
327
+ 'mailjunk.gq',
328
+ 'mailjunk.ml',
329
+ 'mailjunk.tk',
330
+ 'mailmate.com',
331
+ 'mailme.gq',
332
+ 'mailme.ir',
333
+ 'mailme.lv',
334
+ 'mailmetrash.com',
335
+ 'mailmoat.com',
336
+ 'mailms.com',
337
+ 'mailnator.com',
338
+ 'mailnesia.com',
339
+ 'mailnull.com',
340
+ 'mailorg.org',
341
+ 'mailpick.biz',
342
+ 'mailrock.biz',
343
+ 'mailscrap.com',
344
+ 'mailshell.com',
345
+ 'mailsiphon.com',
346
+ 'mailslite.com',
347
+ 'mailtemp.info',
348
+ 'mailtothis.com',
349
+ 'mailtrash.net',
350
+ 'mailtv.net',
351
+ 'mailtv.tv',
352
+ 'mailzilla.com',
353
+ 'mailzilla.org',
354
+ 'makemetheking.com',
355
+ 'manifestgenerator.com',
356
+ 'mbx.cc',
357
+ 'mega.zik.dj',
358
+ 'meinspamschutz.de',
359
+ 'meltmail.com',
360
+ 'messagebeamer.de',
361
+ 'mezimages.net',
362
+ 'mfsa.ru',
363
+ 'mierdamail.com',
364
+ 'ministry-of-silly-walks.de',
365
+ 'mintemail.com',
366
+ 'misterpinball.de',
367
+ 'mjukgansen.com',
368
+ 'mohmal.com',
369
+ 'moncourrier.fr.nf',
370
+ 'monemail.fr.nf',
371
+ 'monmail.fr.nf',
372
+ 'monumentmail.com',
373
+ 'msa.minsmail.com',
374
+ 'mt2015.com',
375
+ 'mx0.wwwnew.eu',
376
+ 'my10minutemail.com',
377
+ 'mycard.net.ua',
378
+ 'mycleaninbox.net',
379
+ 'myemailboxy.com',
380
+ 'mymail-in.net',
381
+ 'mypacks.net',
382
+ 'mypartyclip.de',
383
+ 'myphantom.com',
384
+ 'mysamp.de',
385
+ 'mytemp.email',
386
+ 'mytempmail.com',
387
+ 'mytemps.com',
388
+ 'mytrashmail.com',
389
+ 'nabala.com',
390
+ 'neomailbox.com',
391
+ 'nepwk.com',
392
+ 'nervmich.net',
393
+ 'nervtansen.de',
394
+ 'netmails.com',
395
+ 'netmails.net',
396
+ 'neverbox.com',
397
+ 'no-spam.ws',
398
+ 'nobulk.com',
399
+ 'noclickemail.com',
400
+ 'nogmailspam.info',
401
+ 'nomail.xl.cx',
402
+ 'nomail2me.com',
403
+ 'nomorespamemails.com',
404
+ 'nospam.ze.tc',
405
+ 'nospam4.us',
406
+ 'nospamfor.us',
407
+ 'nospammail.net',
408
+ 'nothingtoseehere.ca',
409
+ 'nowmymail.com',
410
+ 'nurfuerspam.de',
411
+ 'nus.edu.sg',
412
+ 'nwldx.com',
413
+ 'objectmail.com',
414
+ 'obobbo.com',
415
+ 'odnorazovoe.ru',
416
+ 'oneoffemail.com',
417
+ 'onewaymail.com',
418
+ 'oopi.org',
419
+ 'ordinaryamerican.net',
420
+ 'otherinbox.com',
421
+ 'ourklips.com',
422
+ 'outlawspam.com',
423
+ 'ovpn.to',
424
+ 'owlpic.com',
425
+ 'pancakemail.com',
426
+ 'pimpedupmyspace.com',
427
+ 'pjjkp.com',
428
+ 'plexolan.de',
429
+ 'pookmail.com',
430
+ 'privacy.net',
431
+ 'privatdemail.net',
432
+ 'proxymail.eu',
433
+ 'prtnx.com',
434
+ 'putthisinyouremail.com',
435
+ 'qq.com',
436
+ 'quickinbox.com',
437
+ 'rcpt.at',
438
+ 'reallymymail.com',
439
+ 'recode.me',
440
+ 'recursor.net',
441
+ 'recyclemail.dk',
442
+ 'regbypass.com',
443
+ 'regbypass.comsafe-mail.net',
444
+ 'rejectmail.com',
445
+ 'rhyta.com',
446
+ 'rklips.com',
447
+ 'rmqkr.net',
448
+ 'royal.net',
449
+ 'rppkn.com',
450
+ 'rtrtr.com',
451
+ 's0ny.net',
452
+ 'safe-mail.net',
453
+ 'safersignup.de',
454
+ 'safetymail.info',
455
+ 'safetypost.de',
456
+ 'sandelf.de',
457
+ 'saynotospams.com',
458
+ 'scatmail.com',
459
+ 'schafmail.de',
460
+ 'selfdestructingmail.com',
461
+ 'sendspamhere.com',
462
+ 'sharklasers.com',
463
+ 'shieldedmail.com',
464
+ 'shiftmail.com',
465
+ 'shitmail.me',
466
+ 'shortmail.net',
467
+ 'sibmail.com',
468
+ 'skeefmail.com',
469
+ 'slaskpost.se',
470
+ 'slipry.net',
471
+ 'slopsbox.com',
472
+ 'slowslow.de',
473
+ 'smashmail.de',
474
+ 'smellfear.com',
475
+ 'snakemail.com',
476
+ 'sneakemail.com',
477
+ 'sneakymail.de',
478
+ 'snkmail.com',
479
+ 'sofimail.com',
480
+ 'sofort-mail.de',
481
+ 'softpls.asia',
482
+ 'sogetthis.com',
483
+ 'soodonims.com',
484
+ 'spam.la',
485
+ 'spam.su',
486
+ 'spam4.me',
487
+ 'spamavert.com',
488
+ 'spambob.com',
489
+ 'spambob.net',
490
+ 'spambob.org',
491
+ 'spambog.com',
492
+ 'spambog.de',
493
+ 'spambog.ru',
494
+ 'spambox.us',
495
+ 'spamcannon.com',
496
+ 'spamcannon.net',
497
+ 'spamcero.com',
498
+ 'spamcorptastic.com',
499
+ 'spamcowboy.com',
500
+ 'spamcowboy.net',
501
+ 'spamcowboy.org',
502
+ 'spamday.com',
503
+ 'spamex.com',
504
+ 'spamfighter.cf',
505
+ 'spamfighter.ga',
506
+ 'spamfighter.gq',
507
+ 'spamfighter.ml',
508
+ 'spamfighter.tk',
509
+ 'spamfree24.com',
510
+ 'spamfree24.de',
511
+ 'spamfree24.eu',
512
+ 'spamfree24.info',
513
+ 'spamfree24.net',
514
+ 'spamfree24.org',
515
+ 'spamgoes.in',
516
+ 'spamgourmet.com',
517
+ 'spamgourmet.net',
518
+ 'spamgourmet.org',
519
+ 'spamherelots.com',
520
+ 'spamhereplease.com',
521
+ 'spamhole.com',
522
+ 'spamify.com',
523
+ 'spaminator.de',
524
+ 'spamkill.info',
525
+ 'spaml.com',
526
+ 'spaml.de',
527
+ 'spammotel.com',
528
+ 'spamobox.com',
529
+ 'spamoff.de',
530
+ 'spamslicer.com',
531
+ 'spamspot.com',
532
+ 'spamstack.net',
533
+ 'spamthis.co.uk',
534
+ 'spamtrap.ro',
535
+ 'spamtrail.com',
536
+ 'spamwc.de',
537
+ 'speed.1s.fr',
538
+ 'spoofmail.de',
539
+ 'squizzy.de',
540
+ 'stinkefinger.net',
541
+ 'stuffmail.de',
542
+ 'supergreatmail.com',
543
+ 'supermailer.jp',
544
+ 'superrito.com',
545
+ 'superstachel.de',
546
+ 'suremail.info',
547
+ 'svk.jp',
548
+ 'sweetxxx.de',
549
+ 'tafmail.com',
550
+ 'tagyoureit.com',
551
+ 'talkinator.com',
552
+ 'tapchicuoihoi.com',
553
+ 'teewars.org',
554
+ 'temp-mail.com',
555
+ 'temp-mail.org',
556
+ 'temp-mail.ru',
557
+ 'tempail.com',
558
+ 'tempalias.com',
559
+ 'tempe4mail.com',
560
+ 'tempemail.co.za',
561
+ 'tempemail.com',
562
+ 'tempemail.net',
563
+ 'tempinbox.com',
564
+ 'tempinbox.co.uk',
565
+ 'tempmail.com',
566
+ 'tempmail.eu',
567
+ 'tempmail.it',
568
+ 'tempmail2.com',
569
+ 'tempmaildemo.com',
570
+ 'tempmailer.com',
571
+ 'tempmailer.de',
572
+ 'tempomail.fr',
573
+ 'temporarioemail.com.br',
574
+ 'temporaryemail.net',
575
+ 'temporaryemail.us',
576
+ 'temporaryforwarding.com',
577
+ 'temporaryinbox.com',
578
+ 'temporarymailaddress.com',
579
+ 'tempr.email',
580
+ 'tempsky.com',
581
+ 'tempthe.net',
582
+ 'tempymail.com',
583
+ 'thanksnospam.info',
584
+ 'thankyou2010.com',
585
+ 'thc.st',
586
+ 'thecriminals.com',
587
+ 'thisisnotmyrealemail.com',
588
+ 'thismail.net',
589
+ 'throwam.com',
590
+ 'throwaway.email',
591
+ 'throwawayemailaddress.com',
592
+ 'throwawaymail.com',
593
+ 'tittbit.in',
594
+ 'tizi.com',
595
+ 'tmailinator.com',
596
+ 'toiea.com',
597
+ 'toomail.biz',
598
+ 'topranklist.de',
599
+ 'tradermail.info',
600
+ 'trash-amil.com',
601
+ 'trash-mail.at',
602
+ 'trash-mail.com',
603
+ 'trash-mail.de',
604
+ 'trash2009.com',
605
+ 'trashemail.de',
606
+ 'trashmail.at',
607
+ 'trashmail.com',
608
+ 'trashmail.de',
609
+ 'trashmail.io',
610
+ 'trashmail.me',
611
+ 'trashmail.net',
612
+ 'trashmail.org',
613
+ 'trashmail.ws',
614
+ 'trashmailer.com',
615
+ 'trashymail.com',
616
+ 'trashymail.net',
617
+ 'trbvm.com',
618
+ 'trialmail.de',
619
+ 'trickmail.net',
620
+ 'trillianpro.com',
621
+ 'turual.com',
622
+ 'twinmail.de',
623
+ 'tyldd.com',
624
+ 'uggsrock.com',
625
+ 'umail.net',
626
+ 'upliftnow.com',
627
+ 'uplipht.com',
628
+ 'venompen.com',
629
+ 'veryreallyelement.com',
630
+ 'viditag.com',
631
+ 'viewcastmedia.com',
632
+ 'viewcastmedia.net',
633
+ 'viewcastmedia.org',
634
+ 'vomoto.com',
635
+ 'vpn.st',
636
+ 'vsimcard.com',
637
+ 'vubby.com',
638
+ 'wasteland.rfc822.org',
639
+ 'webemail.me',
640
+ 'weg-werf-email.de',
641
+ 'wegwerfadresse.de',
642
+ 'wegwerfemail.com',
643
+ 'wegwerfemail.de',
644
+ 'wegwerfmail.de',
645
+ 'wegwerfmail.net',
646
+ 'wegwerfmail.org',
647
+ 'wetrainbayarea.com',
648
+ 'wetrainbayarea.org',
649
+ 'wh4f.org',
650
+ 'whatiaas.com',
651
+ 'whatpaas.com',
652
+ 'whyspam.me',
653
+ 'wickmail.net',
654
+ 'wilemail.com',
655
+ 'willhackforfood.biz',
656
+ 'willselfdestruct.com',
657
+ 'winemaven.info',
658
+ 'wronghead.com',
659
+ 'wuzup.net',
660
+ 'wuzupmail.net',
661
+ 'wwwnew.eu',
662
+ 'xagloo.com',
663
+ 'xemaps.com',
664
+ 'xents.com',
665
+ 'xjoi.com',
666
+ 'xmaily.com',
667
+ 'xoxy.net',
668
+ 'yapped.net',
669
+ 'yep.it',
670
+ 'yogamaven.com',
671
+ 'yomail.info',
672
+ 'yopmail.com',
673
+ 'yopmail.fr',
674
+ 'yopmail.gq',
675
+ 'yopmail.net',
676
+ 'yourdomain.com',
677
+ 'ypmail.webarnak.fr.eu.org',
678
+ 'yuurok.com',
679
+ 'zehnminutenmail.de',
680
+ 'zippymail.info',
681
+ 'zoaxe.com',
682
+ 'zoemail.org'
683
+ ]);
@@ -0,0 +1,5 @@
1
+ export { DISPOSABLE_DOMAINS } from './domains';
2
+ export { validateEmailDomain } from './mx-validator';
3
+ export type { EmailValidationResult, MxValidationOptions } from './types';
4
+ export { isDisposableEmail } from './validator';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { DISPOSABLE_DOMAINS } from './domains';
2
+ export { validateEmailDomain } from './mx-validator';
3
+ export { isDisposableEmail } from './validator';
@@ -0,0 +1,11 @@
1
+ import type { EmailValidationResult, MxValidationOptions } from './types';
2
+ /**
3
+ * Validate an email domain against the disposable blocklist and optionally
4
+ * check DNS MX records to verify the domain can receive mail.
5
+ *
6
+ * @param email - Email address to validate
7
+ * @param opts - Validation options (MX check, DNS timeout)
8
+ * @returns Validation result with reason if invalid
9
+ */
10
+ export declare function validateEmailDomain(email: string, opts?: MxValidationOptions): Promise<EmailValidationResult>;
11
+ //# sourceMappingURL=mx-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mx-validator.d.ts","sourceRoot":"","sources":["../src/mx-validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAuEhC"}
@@ -0,0 +1,70 @@
1
+ import { resolve } from 'node:dns/promises';
2
+ import { DISPOSABLE_DOMAINS } from './domains';
3
+ /**
4
+ * Validate an email domain against the disposable blocklist and optionally
5
+ * check DNS MX records to verify the domain can receive mail.
6
+ *
7
+ * @param email - Email address to validate
8
+ * @param opts - Validation options (MX check, DNS timeout)
9
+ * @returns Validation result with reason if invalid
10
+ */
11
+ export async function validateEmailDomain(email, opts = {}) {
12
+ const { checkMx = false, dnsTimeout = 5000 } = opts;
13
+ const domain = email.split('@')[1]?.toLowerCase().trim();
14
+ if (!domain) {
15
+ return {
16
+ valid: false,
17
+ reason: 'invalid-domain',
18
+ message: 'Invalid email address format.'
19
+ };
20
+ }
21
+ // 1. Check disposable blocklist
22
+ if (DISPOSABLE_DOMAINS.has(domain)) {
23
+ return {
24
+ valid: false,
25
+ reason: 'disposable',
26
+ message: 'Disposable email addresses are not allowed. Please use a permanent email.'
27
+ };
28
+ }
29
+ // 2. Optionally check MX records
30
+ if (checkMx) {
31
+ try {
32
+ const records = await Promise.race([
33
+ resolve(domain, 'MX'),
34
+ new Promise((_, reject) => setTimeout(() => reject(new Error('DNS timeout')), dnsTimeout))
35
+ ]);
36
+ if (!records || (Array.isArray(records) && records.length === 0)) {
37
+ return {
38
+ valid: false,
39
+ reason: 'no-mx-records',
40
+ message: 'This email domain does not appear to accept mail. Please use a different email.'
41
+ };
42
+ }
43
+ }
44
+ catch (error) {
45
+ // Check for DNS error codes (ENOTFOUND / ENODATA = domain doesn't exist)
46
+ const code = error != null && typeof error === 'object' && 'code' in error
47
+ ? error.code
48
+ : undefined;
49
+ if (code === 'ENOTFOUND' || code === 'ENODATA') {
50
+ return {
51
+ valid: false,
52
+ reason: 'no-mx-records',
53
+ message: 'This email domain does not exist. Please check your email address.'
54
+ };
55
+ }
56
+ // DNS timeout or other transient error — don't block the user
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ if (message === 'DNS timeout') {
59
+ return {
60
+ valid: false,
61
+ reason: 'dns-error',
62
+ message: 'Unable to verify email domain. Please try again in a moment.'
63
+ };
64
+ }
65
+ // Other DNS errors — allow through (fail open)
66
+ return { valid: true };
67
+ }
68
+ }
69
+ return { valid: true };
70
+ }
@@ -0,0 +1,12 @@
1
+ export type EmailValidationResult = {
2
+ valid: boolean;
3
+ reason?: 'disposable' | 'no-mx-records' | 'invalid-domain' | 'dns-error';
4
+ message?: string;
5
+ };
6
+ export type MxValidationOptions = {
7
+ /** Check DNS MX records for the domain. Adds latency (~100-500ms). Default: false */
8
+ checkMx?: boolean;
9
+ /** Timeout for DNS lookups in milliseconds. Default: 5000 */
10
+ dnsTimeout?: number;
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,WAAW,CAAC;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
package/dist/types.js ADDED
File without changes
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check if an email address uses a known disposable/temporary email domain.
3
+ * @param email - Email address to check
4
+ * @returns true if the domain is a known disposable email provider
5
+ */
6
+ export declare function isDisposableEmail(email: string): boolean;
7
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIxD"}
@@ -0,0 +1,12 @@
1
+ import { DISPOSABLE_DOMAINS } from './domains';
2
+ /**
3
+ * Check if an email address uses a known disposable/temporary email domain.
4
+ * @param email - Email address to check
5
+ * @returns true if the domain is a known disposable email provider
6
+ */
7
+ export function isDisposableEmail(email) {
8
+ const domain = email.split('@')[1]?.toLowerCase().trim();
9
+ if (!domain)
10
+ return false;
11
+ return DISPOSABLE_DOMAINS.has(domain);
12
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@bitclaw/disposable-email",
3
+ "version": "1.1.0",
4
+ "description": "Fast disposable and free email provider detection with optional MX record validation",
5
+ "files": ["dist", "LICENSE", "README.md"],
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
11
+ },
12
+ "scripts": {
13
+ "build": "tsc -p tsconfig.build.json",
14
+ "test": "bun test",
15
+ "test:watch": "bun test --watch",
16
+ "typecheck": "tsc --noEmit",
17
+ "lint": "biome check",
18
+ "lint:fix": "biome check --write",
19
+ "format": "biome format --write",
20
+ "knip": "knip",
21
+ "prepublishOnly": "npm run build && npm run test",
22
+ "publish:dev": "npm run build && npm publish --tag dev --access public",
23
+ "publish:patch": "npm whoami && npm version patch && git push --follow-tags && npm publish --access public",
24
+ "publish:minor": "npm whoami && npm version minor && git push --follow-tags && npm publish --access public",
25
+ "publish:major": "npm whoami && npm version major && git push --follow-tags && npm publish --access public"
26
+ },
27
+ "keywords": ["disposable-email", "email-validation", "spam-prevention", "mx-validation", "bun"],
28
+ "author": "bitclaw",
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "@biomejs/biome": "^2.4.15",
32
+ "knip": "^6.12.1",
33
+ "@types/bun": "^1.3.9",
34
+ "@types/node": "^22.0.0",
35
+ "typescript": "^5.8.3"
36
+ }
37
+ }