-
Notifications
You must be signed in to change notification settings - Fork 709
/
disposable.php
471 lines (453 loc) · 12.1 KB
/
disposable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
<?php
# Disposable Email Checker - a static php based check for spam emails
# Copyright (C) 2007-2008 Victor Boctor
# This program is distributed under the terms and conditions of the LGPL
# See the README and LICENSE files for details
/**
* A class that checks an email address and provides some facts about whether
* it is a disposable, free web mail, etc. The data that is used to make
* such decision is static as part of the class implementation, hence
* avoiding a round trip to a remote service. This makes the class much
* more efficient in scenarios where performance is an issue.
*/
class DisposableEmailChecker
{
static $forwarding_domains_array = array(
'1chuan.com',
'1zhuan.com',
'4warding.com',
'4warding.net',
'4warding.org',
'despammed.com',
'e4ward.com',
'emailias.com',
'fakemailz.com',
'gishpuppy.com',
'hidemail.de',
'imstations.com',
'jetable.org',
'kasmail.com',
'mailfreeonline.com',
'mailmoat.com',
'mailnull.com',
'mailshell.com',
'mailzilla.com',
'mintemail.com',
'netzidiot.de',
'punkass.com',
'safersignup.de',
'shiftmail.com',
'sneakemail.com',
'spambob.net',
'spamex.com',
'spamgourmet.com',
'spamhole.com',
'spammotel.com',
'spamslicer.com',
'spamtrail.com',
'temporaryforwarding.com',
'trashmail.net',
'xemaps.com',
'xmaily.com'
);
static $trash_domains_array = array(
'10minutemail.com',
'675hosting.com',
'675hosting.net',
'675hosting.org',
'75hosting.com',
'75hosting.net',
'75hosting.org',
'ajaxapp.net',
'amilegit.com',
'amiri.net',
'amiriindustries.com',
'anonymail.dk',
'anonymbox.com',
'bspamfree.org',
'bugmenot.com',
'buyusedlibrarybooks.org',
'deadaddress.com',
'discardmail.com',
'disposeamail.com',
'dispostable.com',
'dodgeit.com',
'dontsendmespam.de',
'emaildienst.de',
'emailmiser.com',
'emailthe.net',
'etranquil.com',
'etranquil.net',
'etranquil.org',
'fakeinbox.com',
'fastacura.com',
'fastchevy.com',
'fastchrysler.com',
'fastkawasaki.com',
'fastmazda.com',
'fastmitsubishi.com',
'fastnissan.com',
'fastsubaru.com',
'fastsuzuki.com',
'fasttoyota.com',
'fastyamaha.com',
'getonemail.com',
'gowikibooks.com',
'gowikicampus.com',
'gowikicars.com',
'gowikifilms.com',
'gowikigames.com',
'gowikimusic.com',
'gowikinetwork.com',
'gowikitravel.com',
'gowikitv.com',
'haltospam.com',
'ichimail.com',
'incognitomail.org',
'ipoo.org',
'killmail.net',
'klassmaster.com',
'link2mail.net',
'lortemail.dk',
'mailcatch.com',
'maileater.com',
'mailin8r.com',
'mailinator.com',
'mailinator.net',
'mailinator2.com',
'mailmetrash.com',
'mailnesia.com',
'mailquack.com',
'mailslapping.com',
'meltmail.com',
'mmmmail.com',
'mt2009.com',
'myspaceinc.com',
'myspaceinc.net',
'myspaceinc.org',
'myspacepimpedup.com',
'mytrashmail.com',
'nepwk.com',
'no-spam.hu',
'nobulk.com',
'noclickemail.com',
'nospamfor.us',
'nowmymail.com',
'oneoffemail.com',
'oneoffmail.com',
'oopi.org',
'ourklips.com',
'pimpedupmyspace.com',
'pookmail.com',
'recyclemail.dk',
'rejectmail.com',
'rklips.com',
'sharklasers.com',
'shortmail.net',
'sofort-mail.de',
'sogetthis.com',
'spam.la',
'spamavert.com',
'spambob.com',
'spambog.com',
'spambox.us',
'spamfree24.com',
'spamfree24.net',
'spamfree24.org',
'spaml.com',
'tempemail.net',
'tempinbox.com',
'tempomail.fr',
'temporaryinbox.com',
'thankyou2010.com',
'thisisnotmyrealemail.com',
'trash-mail.de',
'trash2009.com',
'trashdevil.com',
'trashdevil.de',
'trashmail.net',
'trashymail.com',
'turual.com',
'twinmail.de',
'upliftnow.com',
'uplipht.com',
'viditag.com',
'viewcastmedia.com',
'viewcastmedia.net',
'viewcastmedia.org',
'wetrainbayarea.com',
'wetrainbayarea.org',
'whopy.com',
'whyspam.me',
'wilemail.com',
'willselfdestruct.com',
'xagloo.com',
'yopmail.com'
);
static $shredder_domains_array = array(
'spambob.org'
);
static $time_bound_domains_array = array(
'10minutemail.com',
'bugmenot.com',
'buyusedlibrarybooks.org',
'despam.it',
'dontreg.com',
'dotmsg.com',
'emailto.de',
'getonemail.com',
'guerrillamail.com',
'guerrillamail.net',
'haltospam.com',
'jetable.com',
'jetable.net',
'jetable.org',
'kasmail.com',
'link2mail.net',
'lovemeleaveme.com',
'mailexpire.com',
'mailzilla.com',
'mintemail.com',
'no-spam.hu',
'noclickemail.com',
'oneoffemail.com',
'oopi.org',
'pookmail.com',
'shortmail.net',
'spambox.us',
'spamfree24.com',
'spamfree24.org',
'spamfree24.net',
'spamhole.com',
'spamify.com',
'tempemail.net',
'tempinbox.com',
'temporaryinbox.com',
'temporarily.de',
'trashdevil.com',
'trashdevil.de',
'trashmail.net',
'walala.org',
'wh4f.org',
'yopmail.com'
);
static $open_domains_array = array(
'aim.com',
'aol.com',
'bk.ru',
'blu.it',
'BTinternet.com',
'caramail.com',
'exclusivemail.co.za',
'executive.co.za',
'free.fr',
'freemail.hu',
'gawab.com',
'gmail.com',
'gmx.at',
'gmx.de',
'gmx.net',
'googlemail.com',
'hanmail.net',
'homemail.co.za',
'hotmail.co.uk',
'hotmail.com',
'hotmail.de',
'hotmail.fr',
'hotmail.it',
'inbox.ru',
'iol.it',
'libero.it',
'list.ru',
'lycos.at',
'lycos.co.uk',
'lycos.de',
'lycos.es',
'lycos.it',
'lycos.nl',
'magicmail.co.za',
'mail.com',
'mail.ru',
'mailbox.co.za',
'msn.co.uk',
'msn.com',
'netscape.com',
'netscape.net',
'o2.pl',
'pancakemail.com',
'ravemail.co.za',
'rediffmail.com',
'sapo.pt',
'starmail.co.za',
'talk21.com',
'thecricket.co.za',
'thegolf.co.za',
'thepub.co.za',
'therugby.co.za',
'ukr.net',
'yahoo.ca',
'yahoo.co.in',
'yahoo.co.jp',
'yahoo.co.uk',
'yahoo.com',
'yahoo.com.ar',
'yahoo.com.asia',
'yahoo.com.au',
'yahoo.com.br',
'yahoo.com.cn',
'yahoo.com.es',
'yahoo.com.hk',
'yahoo.com.malaysia',
'yahoo.com.mx',
'yahoo.com.ph',
'yahoo.com.sg',
'yahoo.com.tw',
'yahoo.com.vn',
'yahoo.de',
'yahoo.dk',
'yahoo.es',
'yahoo.fr',
'yahoo.gr',
'yahoo.ie',
'yahoo.it',
'yahoo.se',
'web.de',
'webmail.co.za',
'websurfer.co.za',
'workmail.co.za'
);
/**
* Determines if the email address is disposable.
*
* @param $p_email The email address to validate.
* @returns true: disposable, false: non-disposable.
*/
static function is_disposable_email( $p_email ) {
return (
DisposableEmailChecker::is_forwarding_email( $p_email ) ||
DisposableEmailChecker::is_trash_email( $p_email ) ||
DisposableEmailChecker::is_time_bound_email( $p_email ) ||
DisposableEmailChecker::is_shredder_email( $p_email ) );
}
/**
* Determines if the email address is disposable email that forwards to
* users' email address. This is one of the best kind of disposable
* addresses since emails end up in the user's inbox unless the user
* cancel the address.
*
* @param $p_email The email address to check.
* @returns true: disposable forwarding, false: otherwise.
*/
static function is_forwarding_email( $p_email ) {
$t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
return in_array( $t_domain, DisposableEmailChecker::$forwarding_domains_array );
}
/**
* Determines if the email address is trash email that doesn't forward to
* user's email address. This kind of address can be checked using a
* web page and no password is required for such check. Hence, data sent
* to such address is not protected. Typically users use these addresses
* to signup for a service, and then they never check it again.
*
* @param $p_email The email address to check.
* @returns true: disposable trash mail, false: otherwise.
*/
static function is_trash_email( $p_email ) {
$t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
return in_array( $t_domain, DisposableEmailChecker::$trash_domains_array );
}
/**
* Determines if the email address is a shredder email address. Shredder
* email address delete all received emails without forwarding them or
* making them available for a user to check.
*
* @param $p_email The email address to check.
* @returns true: shredded disposable email, false: otherwise.
*/
static function is_shredder_email( $p_email ) {
$t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
return in_array( $t_domain, DisposableEmailChecker::$shredder_domains_array );
}
/**
* Determines if the email address is time bound, these are the disposable
* addresses that auto expire after a pre-configured time. For example,
* 10 minutes, 1 hour, 2 hours, 1 day, 1 month, etc. These address can
* also be trash emails or forwarding emails.
*
* @param $p_email The email address to check.
* @returns true: time bound disposable email, false: otherwise.
*/
static function is_time_bound_email( $p_email ) {
$t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
return in_array( $t_domain, DisposableEmailChecker::$time_bound_domains_array );
}
/**
* See is_open_domain() for details.
*/
function is_free_email( $p_email ) {
return $this->is_open_email( $p_email );
}
/**
* Determines if the email address is an email address in an open domain. These are
* addresses that users can sign up for, typically free. They then has to login to
* these address to get the emails. These are not considered to be
* disposable emails, however, if the application is providing a free
* trial for an expensive server, then users can signup for more accounts
* to get further trials.
*
* If applications are to block these addresses, it is important to be aware
* that some users use open webmail as their primary email and that such
* service providers include hotmail, gmail, and yahoo.
*
* @param $p_email The email address to check.
* @returns true: open domain email, false: otherwise.
*/
function is_open_email( $p_email ) {
$t_domain = DisposableEmailChecker::_get_domain_from_address( $p_email );
return in_array( $t_domain, DisposableEmailChecker::$open_domains_array );
}
/**
* A debugging function that takes in an email address and dumps out the
* details for such email.
*
* @param $p_email The email address to echo results for. This must be a
* safe script (i.e. no javascript, etc).
*/
function echo_results( $p_email ) {
echo 'email address = ', htmlspecialchars( $p_email ), '<br />';
echo 'is_disposable_email = ', DisposableEmailChecker::is_disposable_email( $p_email ), '<br />';
echo 'is_forwarding_email = ', DisposableEmailChecker::is_forwarding_email( $p_email ), '<br />';
echo 'is_trash_email = ', DisposableEmailChecker::is_trash_email( $p_email ), '<br />';
echo 'is_time_bound_email = ', DisposableEmailChecker::is_time_bound_email( $p_email ), '<br />';
echo 'is_shredder_email = ', DisposableEmailChecker::is_shredder_email( $p_email ), '<br />';
echo 'is_free_email = ', DisposableEmailChecker::is_free_email( $p_email ), '<br />';
}
/**
* A debugging function that outputs some statistics about the number of domains in
* each category.
*/
function echo_stats() {
echo 'Forwarding Domains: ' . count( DisposableEmailChecker::$forwarding_domains_array ) . '<br />';
echo 'Free Domains: ' . count( DisposableEmailChecker::$open_domains_array ) . '<br />';
echo 'Shredded Domains: ' . count( DisposableEmailChecker::$shredder_domains_array ) . '<br />';
echo 'Time Bound: ' . count( DisposableEmailChecker::$time_bound_domains_array ) . '<br />';
echo 'Trash Domains: ' . count( DisposableEmailChecker::$trash_domains_array ) . '<br />';
}
//
// Private functions, shouldn't be called from outside the class
//
/**
* A helper function that takes in an email address and returns a lower case
* domain.
*
* @param $p_email The email address to extra the domain from.
* @returns The lower case domain or empty string if email not valid.
*/
static function _get_domain_from_address( $p_email ) {
$t_domain_pos = strpos( $p_email, '@' );
if ( $t_domain_pos === false ) {
return '';
}
return strtolower( substr( $p_email, $t_domain_pos + 1 ) );
}
}