DrMark-email_quality 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +15 -0
- data/README.rdoc +82 -0
- data/Rakefile +29 -0
- data/lib/email_quality/address.rb +61 -0
- data/lib/email_quality/blacklist.rb +318 -0
- data/lib/email_quality/config.rb +46 -0
- data/lib/email_quality/domain.rb +44 -0
- data/lib/email_quality/validatability.rb +31 -0
- data/lib/email_quality.rb +14 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_email_quality.rb +11 -0
- data/test/test_helper.rb +3 -0
- metadata +86 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
lib/email_quality.rb
|
6
|
+
lib/email_quality/address.rb
|
7
|
+
lib/email_quality/blacklist.rb
|
8
|
+
lib/email_quality/config.rb
|
9
|
+
lib/email_quality/domain.rb
|
10
|
+
lib/email_quality/validatability.rb
|
11
|
+
script/console
|
12
|
+
script/destroy
|
13
|
+
script/generate
|
14
|
+
test/test_email_quality.rb
|
15
|
+
test/test_helper.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
= email_quality
|
2
|
+
|
3
|
+
* http://github.com/drmark/email_quality
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
This gem checks an email address for validity and identifies if it is from a Disposable Email Address (DEA) provider. Disposable email addresses are useful for privacy, but many sites wish to control access when using a DEA.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Check to see if an email domain matches a pattern for validity checking
|
12
|
+
* Check to see if the domain is one of the DEA domains
|
13
|
+
* Return a score for the domain based on its type (trash email, shredder email, free email, etc.) (TODO)
|
14
|
+
* Return errors to allow you to decide how to handle the address
|
15
|
+
|
16
|
+
== SYNOPSIS:
|
17
|
+
|
18
|
+
require 'email_quality'
|
19
|
+
|
20
|
+
# I consider the free email addresses to be acceptable. This will eventually be configurable
|
21
|
+
address = EmailQuality::Address.new('valid@gmail.com')
|
22
|
+
|
23
|
+
address.valid?
|
24
|
+
# => true
|
25
|
+
|
26
|
+
address.domain.to_s
|
27
|
+
# => 'gmail.com'
|
28
|
+
|
29
|
+
address.is_open_email?
|
30
|
+
# => true
|
31
|
+
|
32
|
+
# This is a disposable email address
|
33
|
+
address = EmailQuality::Address.new('notvalid@mailinator.com')
|
34
|
+
|
35
|
+
address.valid?
|
36
|
+
# => false # because it is a DEA
|
37
|
+
|
38
|
+
address.errors
|
39
|
+
# => [:blacklisted]
|
40
|
+
|
41
|
+
address.is_trash_email?
|
42
|
+
# => true
|
43
|
+
|
44
|
+
address.is_disposable_email?
|
45
|
+
# => true
|
46
|
+
|
47
|
+
== REQUIREMENTS:
|
48
|
+
|
49
|
+
* none
|
50
|
+
|
51
|
+
== INSTALL:
|
52
|
+
|
53
|
+
* sudo gem install drmark-email_quality
|
54
|
+
|
55
|
+
== THANKS:
|
56
|
+
|
57
|
+
* Thanks to the creators of the email_veracity gem. I am building upon their work. This will eventually be a substantially different project from that gem.
|
58
|
+
|
59
|
+
== LICENSE:
|
60
|
+
|
61
|
+
(The MIT License)
|
62
|
+
|
63
|
+
Copyright (c) 2009 FIXME full name
|
64
|
+
|
65
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
66
|
+
a copy of this software and associated documentation files (the
|
67
|
+
'Software'), to deal in the Software without restriction, including
|
68
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
69
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
70
|
+
permit persons to whom the Software is furnished to do so, subject to
|
71
|
+
the following conditions:
|
72
|
+
|
73
|
+
The above copyright notice and this permission notice shall be
|
74
|
+
included in all copies or substantial portions of the Software.
|
75
|
+
|
76
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
77
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
78
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
79
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
80
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
81
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
82
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
2
|
+
%w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
3
|
+
require File.dirname(__FILE__) + '/lib/email_quality'
|
4
|
+
|
5
|
+
# Generate all the Rake tasks
|
6
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
7
|
+
$hoe = Hoe.new('email_quality', EmailQuality::VERSION) do |p|
|
8
|
+
p.developer('DrMark', 'drmark@gmail.com')
|
9
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
10
|
+
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
11
|
+
p.rubyforge_name = p.name # TODO this is default value
|
12
|
+
# p.extra_deps = [
|
13
|
+
# ['activesupport','>= 2.0.2'],
|
14
|
+
# ]
|
15
|
+
p.extra_dev_deps = [
|
16
|
+
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
+
]
|
18
|
+
|
19
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
+
|
28
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
+
# task :default => [:spec, :features]
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module EmailQuality
|
2
|
+
class Address
|
3
|
+
|
4
|
+
include Validatability
|
5
|
+
|
6
|
+
attr_reader :domain
|
7
|
+
|
8
|
+
def initialize(email = '')
|
9
|
+
self.email_address = email
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
email_address
|
14
|
+
end
|
15
|
+
|
16
|
+
def email_address
|
17
|
+
@email_address.to_s.strip
|
18
|
+
end
|
19
|
+
|
20
|
+
def email_address=(new_email_address)
|
21
|
+
@email_address = new_email_address.to_s
|
22
|
+
@domain = Domain.new(@email_address.split('@')[1] || '')
|
23
|
+
end
|
24
|
+
|
25
|
+
def is_disposable_email?
|
26
|
+
Blacklist.is_disposable_email?(@domain.name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def is_forwarding_email?
|
30
|
+
Blacklist.is_forwarding_email?(@domain.name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def is_trash_email?
|
34
|
+
Blacklist.is_trash_email?(@domain.name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def is_shredder_email?
|
38
|
+
Blacklist.is_shredder_email?(@domain.name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def is_time_bound_email?
|
42
|
+
Blacklist.is_time_bound_email?(@domain.name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def is_open_email?
|
46
|
+
Blacklist.is_open_email?(@domain.name)
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def validate!
|
52
|
+
add_error(:malformed) if !pattern_valid?
|
53
|
+
add_errors(domain.errors)
|
54
|
+
end
|
55
|
+
|
56
|
+
def pattern_valid?
|
57
|
+
@email_address =~ Config[:valid_pattern]
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,318 @@
|
|
1
|
+
module EmailQuality
|
2
|
+
class Blacklist
|
3
|
+
|
4
|
+
attr_reader :value
|
5
|
+
class <<self
|
6
|
+
attr_reader :all_domains, :forwarding_domains, :trash_domains, :shredder_domains, :time_bound_domains, :open_domains
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(ary = @@all_domains)
|
11
|
+
@value = ary
|
12
|
+
end
|
13
|
+
|
14
|
+
# the full list of invalid email domains
|
15
|
+
@all_domains = %w[0815.ru 0sg.net 0wnd.net 0wnd.org 10minutemail.com 12hourmail.com 1chuan.com 1zhuan.com 21cn.com 2prong.com 3126.com 3d-painting.com 3g.ua 4warding.com 4warding.net 4warding.org 50e.info 6url.com 9ox.net a-bc.net abwesend.de addcom.de agnitumhost.net akapost.com alpenjodel.de alphafrau.de amorki.pl anonbox.net anonymbox.com antichef.com antichef.net antispam.de antispam24.de autosfromus.com baldmama.de baldpapa.de ballyfinance.com betriebsdirektor.de bigmir.net bin-wieder-da.de bio-muesli.info bio-muesli.net bk.ru bleib-bei-mir.de blockfilter.com bluebottle.com bodhi.lawlita.com bonbon.net briefemail.com brokenvalve.com brokenvalve.org bsnow.net bspamfree.org buerotiger.de bugmenot.com bumpymail.com buy-24h.net.ru cashette.com center-mail.de centermail.at centermail.ch centermail.com centermail.de centermail.info centermail.net cghost.s-a-d.de chongsoft.org cool.fr.nf coole-files.de cosmorph.com courriel.fr.nf curryworld.de cust.in cyber-matrix.com dandikmail.com dating4best.net deadspam.com despam.it despammed.com dfgh.net die-besten-bilder.de die-genossen.de die-optimisten.de die-optimisten.net dieMailbox.de digital-filestore.de directbox.com discardmail.com discardmail.de discartmail.com disposeamail.com docmail.cz dodgeit.com dodgit.com dogit.com dontreg.com dontsendmespam.de dontsentmespam.de download-privat.de dumpandjunk.com dumpmail.com dumpmail.de dyndns.org e-mail.com e-mail.org e4ward.com eintagsmail.de email.org email4u.info emaildienst.de emailias.com emailmiser.com emailtaxi.de emailto.de emailwarden.com enterto.com example.com fahr-zur-hoelle.org fakeinformation.com falseaddress.com fantasymail.de farifluset.mailexpire.com fastacura.com fastchevy.com fastchrysler.com fastkawasaki.com fastmazda.com fastmitsubishi.com fastnissan.com fastsubaru.com fastsuzuki.com fasttoyota.com fastyamaha.com feinripptraeger.de fettabernett.de filzmail.com fishfuse.com forgetmail.com freemeilaadressforall.net freudenkinder.de fromru.com front14.org gawab.com gentlemansclub.de getonemail.com ghosttexter.de gishpuppy.com gold-profits.info goldtoolbox.com golfilla.info great-host.in greensloth.com guerillamail.com guerillamail.org guerrillamail.biz guerrillamail.com guerrillamail.de guerrillamail.info guerrillamail.org guerrillamailblock.com h8s.org hab-verschlafen.de habmalnefrage.de haltospam.com hatespam.org herr-der-mails.de hidemail.de home.de hush.com hushmail.com i.ua ich-bin-verrueckt-nach-dir.de ich-will-net.de imails.info imstations.com inbox.ru inbox2.info inboxclean.org incognitomail.net inerted.com inet.ua inmail24.com ipoo.org ist-allein.info ist-einmalig.de ist-ganz-allein.de ist-willig.de izmail.net jetable.com jetable.de jetable.fr.nf jetable.net jetable.org jetfix.ee jetzt-bin-ich-dran.com jn-club.de junkmail.com kaffeeschluerfer.com kaffeeschluerfer.de kasmail.com killmail.com killmail.net kinglibrary.net klassmaster.com klassmaster.net kommespaeter.de krim.ws kuh.mu kulturbetrieb.info lass-es-geschehen.de liebt-dich.info link2mail.net list.ru listomail.com litedrop.com lortemail.dk loveyouforever.de maennerversteherin.com maennerversteherin.de mail.by mail.htl22.at mail.misterpinball.de mail.ru mail.svenz.eu mail15.com mail2rss.org mail333.com mail4days.com mail4u.info mailblocks.com mailbucket.org mailcatch.com maileater.com mailexpire.com mailfreeonline.com mailin8r.com mailinater.com mailinator.com mailinator.net mailinator2.com mailinblack.com mailmoat.com mailnull.com mailquack.com mailshell.com mailsiphon.com mailtrash.net mailueberfall.de mailzilla.com makemetheking.com mamber.net meine-dateien.info meine-diashow.de meine-fotos.info meine-urlaubsfotos.de meinspamschutz.de messagebeamer.de metaping.com mintemail.com mintemail.uni.cc mns.ru moncourrier.fr.nf monemail.fr.nf monmail.fr.nf mt2009.com mufmail.com muskelshirt.de mx0.wwwnew.eu my-mail.ch myadult.info mycleaninbox.net mymail-in.net myspamless.com mytempemail.com mytop-in.net mytrashmail.com mytrashmail.compookmail.com nervmich.net nervtmich.net netmails.com netmails.net netterchef.de netzidiot.de neue-dateien.de neverbox.com nm.ru no-spam.ws nobulk.com nomail2me.com nospam4.us nospamfor.us nospammail.net nowmymail.com nullbox.info nur-fuer-spam.de nurfuerspam.de nybella.com odaymail.com office-dateien.de oikrach.com oneoffemail.com oopi.org open.by orangatango.com partybombe.de partyheld.de phreaker.net pisem.net pleasedontsendmespam.de polizisten-duzer.de poofy.org pookmail.com pornobilder-mal-gratis.com portsaid.cc postfach.cc privacy.net prydirect.info pryworld.info public-files.de punkass.com put2.net quantentunnel.de qv7.info ralib.com raubtierbaendiger.de recode.me record.me recursor.net rejectmail.com rootprompt.org saeuferleber.de safe-mail.net safersignup.de sags-per-mail.de sandelf.de satka.net schmusemail.de schreib-doch-mal-wieder.de senseless-entertainment.com shared-files.de shieldedmail.com shinedyoureyes.com shortmail.net sibmail.com siria.cc skeefmail.net slaskpost.se slopsbox.com sms.at sneakemail.com sofort-mail.de sofortmail.de sogetthis.com sonnenkinder.org soodonims.com spam.la spamavert.com spambob.com spambob.net spambob.org spambog.com spambog.de spambog.ru spambox.us spamcannon.com spamcannon.net spamcon.org spamcorptastic.com spamcowboy.com spamcowboy.net spamcowboy.org spamday.com spameater.com spameater.org spamex.com spamfree24.com spamfree24.de spamfree24.eu spamfree24.info spamfree24.net spamfree24.org spamgourmet.com spamgourmet.net spamgourmet.org spamgrube.net spamherelots.com spamhole.com spamify.com spaminator.de spaml.com spammote.com spammotel.com spammuffel.de spamoff.de spamreturn.com spamspot.com spamtrail.com sperke.net sriaus.com streber24.de super-auswahl.de sweetville.net synchromash.com tagesmail.eu teewars.org temp-mail.com temp-mail.org tempe-mail.com tempemail.biz tempemail.net tempinbox.com tempomail.fr temporarily.de temporaryforwarding.com temporaryinbox.com terminverpennt.de test.com test.de thepryam.info thisisnotmyrealemail.com topmail-files.de tortenboxer.de totalmail.de trash-mail.com trash-mail.de trashbox.eu trashdevil.com trashdevil.de trashmail.com trashmail.de trashmail.net trashmail.org trashymail.com trashymail.net trimix.cn turboprinz.de turboprinzessin.de tut.by twinmail.de ua.fm uk2.net ukr.net unterderbruecke.de verlass-mich-nicht.de vinbazar.com vollbio.de volloeko.de vorsicht-bissig.de vorsicht-scharf.de walala.org war-im-urlaub.de wbb3.de webmail4u.eu wegwerfadresse.de wegwerfemail.com wegwerfemail.de weibsvolk.de weibsvolk.org weinenvorglueck.de wh4f.org whopy.com will-hier-weg.de willhackforfood.biz wir-haben-nachwuchs.de wir-sind-cool.org wirsindcool.de wolke7.net women-at-work.org wormseo.cn wp.pl wronghead.com wuzup.net xents.com xmail.com xmaily.com xoxy.net xsecurity.org yandex.ru yesey.net yopmail.com yopmail.fr yopmail.net yopweb.com youmailr.com ystea.org yzbid.com zoemail.com zoemail.net zweb.in ]
|
16
|
+
|
17
|
+
@forwarding_domains = ['1chuan.com',
|
18
|
+
'1zhuan.com',
|
19
|
+
'4warding.com',
|
20
|
+
'4warding.net',
|
21
|
+
'4warding.org',
|
22
|
+
'despammed.com',
|
23
|
+
'e4ward.com',
|
24
|
+
'emailias.com',
|
25
|
+
'fakemailz.com',
|
26
|
+
'gishpuppy.com',
|
27
|
+
'hidemail.de',
|
28
|
+
'imstations.com',
|
29
|
+
'jetable.org',
|
30
|
+
'kasmail.com',
|
31
|
+
'mailfreeonline.com',
|
32
|
+
'mailmoat.com',
|
33
|
+
'mailnull.com',
|
34
|
+
'mailshell.com',
|
35
|
+
'mailzilla.com',
|
36
|
+
'mintemail.com',
|
37
|
+
'netzidiot.de',
|
38
|
+
'punkass.com',
|
39
|
+
'safersignup.de',
|
40
|
+
'shiftmail.com',
|
41
|
+
'sneakemail.com',
|
42
|
+
'spambob.net',
|
43
|
+
'spamex.com',
|
44
|
+
'spamgourmet.com',
|
45
|
+
'spamhole.com',
|
46
|
+
'spammotel.com',
|
47
|
+
'spamslicer.com',
|
48
|
+
'spamtrail.com',
|
49
|
+
'temporaryforwarding.com',
|
50
|
+
'trashmail.net',
|
51
|
+
'xemaps.com',
|
52
|
+
'xmaily.com']
|
53
|
+
|
54
|
+
@trash_domains = ['10minutemail.com',
|
55
|
+
'675hosting.com',
|
56
|
+
'675hosting.net',
|
57
|
+
'675hosting.org',
|
58
|
+
'75hosting.com',
|
59
|
+
'75hosting.net',
|
60
|
+
'75hosting.org',
|
61
|
+
'ajaxapp.net',
|
62
|
+
'amiri.net',
|
63
|
+
'amiriindustries.com',
|
64
|
+
'anonymail.dk',
|
65
|
+
'bugmenot.com',
|
66
|
+
'bspamfree.org',
|
67
|
+
'buyusedlibrarybooks.org',
|
68
|
+
'discardmail.com',
|
69
|
+
'dodgeit.com',
|
70
|
+
'dontsendmespam.de',
|
71
|
+
'emaildienst.de',
|
72
|
+
'emailmiser.com',
|
73
|
+
'etranquil.com',
|
74
|
+
'etranquil.net',
|
75
|
+
'etranquil.org',
|
76
|
+
'fastacura.com',
|
77
|
+
'fastchevy.com',
|
78
|
+
'fastchrysler.com',
|
79
|
+
'fastkawasaki.com',
|
80
|
+
'fastmazda.com',
|
81
|
+
'fastmitsubishi.com',
|
82
|
+
'fastnissan.com',
|
83
|
+
'fastsubaru.com',
|
84
|
+
'fastsuzuki.com',
|
85
|
+
'fasttoyota.com',
|
86
|
+
'fastyamaha.com',
|
87
|
+
'getonemail.com',
|
88
|
+
'gowikibooks.com',
|
89
|
+
'gowikicampus.com',
|
90
|
+
'gowikicars.com',
|
91
|
+
'gowikifilms.com',
|
92
|
+
'gowikigames.com',
|
93
|
+
'gowikimusic.com',
|
94
|
+
'gowikinetwork.com',
|
95
|
+
'gowikitravel.com',
|
96
|
+
'gowikitv.com',
|
97
|
+
'haltospam.com',
|
98
|
+
'ichimail.com',
|
99
|
+
'ipoo.org',
|
100
|
+
'killmail.net',
|
101
|
+
'klassmaster.com',
|
102
|
+
'link2mail.net',
|
103
|
+
'lortemail.dk',
|
104
|
+
'maileater.com',
|
105
|
+
'mailin8r.com',
|
106
|
+
'mailinator.com',
|
107
|
+
'mailinator.net',
|
108
|
+
'mailinator2.com',
|
109
|
+
'mailquack.com',
|
110
|
+
'mailslapping.com',
|
111
|
+
'myspaceinc.com',
|
112
|
+
'myspaceinc.net',
|
113
|
+
'myspaceinc.org',
|
114
|
+
'myspacepimpedup.com',
|
115
|
+
'mytrashmail.com',
|
116
|
+
'no-spam.hu',
|
117
|
+
'nobulk.com',
|
118
|
+
'noclickemail.com',
|
119
|
+
'nospamfor.us',
|
120
|
+
'oneoffemail.com',
|
121
|
+
'oneoffmail.com',
|
122
|
+
'oopi.org',
|
123
|
+
'ourklips.com',
|
124
|
+
'pimpedupmyspace.com',
|
125
|
+
'pookmail.com',
|
126
|
+
'rejectmail.com',
|
127
|
+
'recyclemail.dk',
|
128
|
+
'rklips.com',
|
129
|
+
'shortmail.net',
|
130
|
+
'sofort-mail.de',
|
131
|
+
'sogetthis.com',
|
132
|
+
'spam.la',
|
133
|
+
'spamavert.com',
|
134
|
+
'spambob.com',
|
135
|
+
'spambog.com',
|
136
|
+
'spamfree24.com',
|
137
|
+
'spamfree24.net',
|
138
|
+
'spamfree24.org',
|
139
|
+
'spaml.com',
|
140
|
+
'tempemail.net',
|
141
|
+
'tempinbox.com',
|
142
|
+
'temporaryinbox.com',
|
143
|
+
'trash-mail.de',
|
144
|
+
'trashdevil.com',
|
145
|
+
'trashdevil.de',
|
146
|
+
'trashmail.net',
|
147
|
+
'turual.com',
|
148
|
+
'twinmail.de',
|
149
|
+
'upliftnow.com',
|
150
|
+
'uplipht.com',
|
151
|
+
'viditag.com',
|
152
|
+
'viewcastmedia.com',
|
153
|
+
'viewcastmedia.net',
|
154
|
+
'viewcastmedia.org',
|
155
|
+
'wetrainbayarea.com',
|
156
|
+
'wetrainbayarea.org',
|
157
|
+
'whopy.com',
|
158
|
+
'willselfdestruct.com',
|
159
|
+
'wilemail.com',
|
160
|
+
'xagloo.com',
|
161
|
+
'yopmail.com']
|
162
|
+
|
163
|
+
@shredder_domains = ['spambob.org']
|
164
|
+
|
165
|
+
@time_bound_domains = ['10minutemail.com',
|
166
|
+
'bugmenot.com',
|
167
|
+
'buyusedlibrarybooks.org',
|
168
|
+
'despam.it',
|
169
|
+
'dontreg.com',
|
170
|
+
'dotmsg.com',
|
171
|
+
'emailto.de',
|
172
|
+
'getonemail.com',
|
173
|
+
'guerrillamail.com',
|
174
|
+
'guerrillamail.net',
|
175
|
+
'haltospam.com',
|
176
|
+
'jetable.com',
|
177
|
+
'jetable.net',
|
178
|
+
'jetable.org',
|
179
|
+
'kasmail.com',
|
180
|
+
'link2mail.net',
|
181
|
+
'lovemeleaveme.com',
|
182
|
+
'mailexpire.com',
|
183
|
+
'mailzilla.com',
|
184
|
+
'mintemail.com',
|
185
|
+
'no-spam.hu',
|
186
|
+
'noclickemail.com',
|
187
|
+
'oneoffemail.com',
|
188
|
+
'oopi.org',
|
189
|
+
'pookmail.com',
|
190
|
+
'shortmail.net',
|
191
|
+
'spambox.us',
|
192
|
+
'spamfree24.com',
|
193
|
+
'spamfree24.org',
|
194
|
+
'spamfree24.net',
|
195
|
+
'spamhole.com',
|
196
|
+
'spamify.com',
|
197
|
+
'tempemail.net',
|
198
|
+
'tempinbox.com',
|
199
|
+
'temporaryinbox.com',
|
200
|
+
'temporarily.de',
|
201
|
+
'trashdevil.com',
|
202
|
+
'trashdevil.de',
|
203
|
+
'trashmail.net',
|
204
|
+
'walala.org',
|
205
|
+
'wh4f.org',
|
206
|
+
'yopmail.com']
|
207
|
+
|
208
|
+
@open_domains = ['aim.com',
|
209
|
+
'aol.com',
|
210
|
+
'bk.ru',
|
211
|
+
'blu.it',
|
212
|
+
'BTinternet.com',
|
213
|
+
'caramail.com',
|
214
|
+
'exclusivemail.co.za',
|
215
|
+
'executive.co.za',
|
216
|
+
'free.fr',
|
217
|
+
'freemail.hu',
|
218
|
+
'gawab.com',
|
219
|
+
'gmail.com',
|
220
|
+
'gmx.at',
|
221
|
+
'gmx.de',
|
222
|
+
'gmx.net',
|
223
|
+
'googlemail.com',
|
224
|
+
'hanmail.net',
|
225
|
+
'homemail.co.za',
|
226
|
+
'hotmail.co.uk',
|
227
|
+
'hotmail.com',
|
228
|
+
'hotmail.de',
|
229
|
+
'hotmail.fr',
|
230
|
+
'hotmail.it',
|
231
|
+
'inbox.ru',
|
232
|
+
'iol.it',
|
233
|
+
'libero.it',
|
234
|
+
'list.ru',
|
235
|
+
'lycos.at',
|
236
|
+
'lycos.co.uk',
|
237
|
+
'lycos.de',
|
238
|
+
'lycos.es',
|
239
|
+
'lycos.it',
|
240
|
+
'lycos.nl',
|
241
|
+
'magicmail.co.za',
|
242
|
+
'mail.com',
|
243
|
+
'mail.ru',
|
244
|
+
'mailbox.co.za',
|
245
|
+
'msn.co.uk',
|
246
|
+
'msn.com',
|
247
|
+
'netscape.com',
|
248
|
+
'netscape.net',
|
249
|
+
'o2.pl',
|
250
|
+
'pancakemail.com',
|
251
|
+
'ravemail.co.za',
|
252
|
+
'rediffmail.com',
|
253
|
+
'starmail.co.za',
|
254
|
+
'talk21.com',
|
255
|
+
'thecricket.co.za',
|
256
|
+
'thegolf.co.za',
|
257
|
+
'thepub.co.za',
|
258
|
+
'therugby.co.za',
|
259
|
+
'ukr.net',
|
260
|
+
'yahoo.ca',
|
261
|
+
'yahoo.co.in',
|
262
|
+
'yahoo.co.jp',
|
263
|
+
'yahoo.co.uk',
|
264
|
+
'yahoo.com',
|
265
|
+
'yahoo.com.ar',
|
266
|
+
'yahoo.com.asia',
|
267
|
+
'yahoo.com.au',
|
268
|
+
'yahoo.com.br',
|
269
|
+
'yahoo.com.cn',
|
270
|
+
'yahoo.com.es',
|
271
|
+
'yahoo.com.hk',
|
272
|
+
'yahoo.com.malaysia',
|
273
|
+
'yahoo.com.mx',
|
274
|
+
'yahoo.com.ph',
|
275
|
+
'yahoo.com.sg',
|
276
|
+
'yahoo.com.tw',
|
277
|
+
'yahoo.com.vn',
|
278
|
+
'yahoo.de',
|
279
|
+
'yahoo.dk',
|
280
|
+
'yahoo.es',
|
281
|
+
'yahoo.fr',
|
282
|
+
'yahoo.gr',
|
283
|
+
'yahoo.ie',
|
284
|
+
'yahoo.it',
|
285
|
+
'yahoo.se',
|
286
|
+
'web.de',
|
287
|
+
'webmail.co.za',
|
288
|
+
'websurfer.co.za',
|
289
|
+
'workmail.co.za']
|
290
|
+
|
291
|
+
def self.is_disposable_email?(domain)
|
292
|
+
@all_domains.include?(domain) ? true : false
|
293
|
+
end
|
294
|
+
|
295
|
+
def self.is_forwarding_email?(domain)
|
296
|
+
@forwarding_domains.include?(domain) ? true : false
|
297
|
+
end
|
298
|
+
|
299
|
+
def self.is_trash_email?(domain)
|
300
|
+
@trash_domains.include?(domain) ? true : false
|
301
|
+
end
|
302
|
+
|
303
|
+
def self.is_shredder_email?(domain)
|
304
|
+
@shredder_domains.include?(domain) ? true : false
|
305
|
+
end
|
306
|
+
|
307
|
+
def self.is_time_bound_email?(domain)
|
308
|
+
@time_bound_domains.include?(domain) ? true : false
|
309
|
+
end
|
310
|
+
|
311
|
+
def self.is_open_email?(domain)
|
312
|
+
@open_domains.include?(domain) ? true : false
|
313
|
+
end
|
314
|
+
|
315
|
+
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module EmailQuality
|
2
|
+
class Config
|
3
|
+
|
4
|
+
DEFAULT_OPTIONS = {
|
5
|
+
:whitelist => %w[ aol.com gmail.com hotmail.com mac.com msn.com
|
6
|
+
rogers.com sympatico.ca yahoo.com telus.com sprint.com sprint.ca ],
|
7
|
+
:blacklist => %w[ dodgeit.com mintemail.com mintemail.uni.cc
|
8
|
+
1mintemail.mooo.com spammotel.com trashmail.net ],
|
9
|
+
:valid_pattern =>
|
10
|
+
/\A(([\w]+[\w\+_\-\.]+[\+_\-\.]{0})@((?:[-a-z0-9]+\.)+[a-z]{2,})){1}\Z/i,
|
11
|
+
:enforce_blacklist => true,
|
12
|
+
:enforce_whitelist => true }
|
13
|
+
@options = DEFAULT_OPTIONS.clone
|
14
|
+
|
15
|
+
def Config.[](key)
|
16
|
+
@options[key.to_sym]
|
17
|
+
end
|
18
|
+
|
19
|
+
def Config.[]=(key, value)
|
20
|
+
@options[key.to_sym] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
def Config.options
|
24
|
+
@options
|
25
|
+
end
|
26
|
+
|
27
|
+
def Config.options=(options)
|
28
|
+
unless options.is_a?(Hash)
|
29
|
+
raise ArgumentError, "options must be a Hash not #{options.class}"
|
30
|
+
end
|
31
|
+
@options = options
|
32
|
+
end
|
33
|
+
|
34
|
+
def Config.update(options)
|
35
|
+
unless options.is_a?(Hash)
|
36
|
+
raise ArgumentError, "options must be a Hash not #{options.class}"
|
37
|
+
end
|
38
|
+
@options.update(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def Config.revert!
|
42
|
+
@options = DEFAULT_OPTIONS.clone
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module EmailQuality
|
2
|
+
class Domain
|
3
|
+
|
4
|
+
include Validatability
|
5
|
+
|
6
|
+
def Domain.whitelisted?(name)
|
7
|
+
Config[:whitelist].include?(name.downcase.strip) ? true : false
|
8
|
+
end
|
9
|
+
|
10
|
+
def Domain.blacklisted?(name)
|
11
|
+
# Config[:blacklist].include?(name.downcase.strip)
|
12
|
+
Blacklist.is_disposable_email?(name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(name = '')
|
16
|
+
@name = name
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
name
|
21
|
+
end
|
22
|
+
|
23
|
+
def name
|
24
|
+
@name.to_s.downcase.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
def whitelisted?
|
28
|
+
Domain.whitelisted?(name) ? true : false
|
29
|
+
end
|
30
|
+
|
31
|
+
def blacklisted?
|
32
|
+
Domain.blacklisted?(name) ? true : false
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def validate!
|
38
|
+
return if whitelisted?
|
39
|
+
add_error(:blacklisted) if blacklisted? &&
|
40
|
+
Config[:enforce_blacklist]
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module EmailQuality
|
2
|
+
module Validatability
|
3
|
+
|
4
|
+
def valid?
|
5
|
+
self.errors.empty?
|
6
|
+
end
|
7
|
+
|
8
|
+
def errors
|
9
|
+
self.clear_errors!
|
10
|
+
self.validate!
|
11
|
+
@errors
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def validate!
|
17
|
+
# Adds errors to the object.
|
18
|
+
end
|
19
|
+
|
20
|
+
def clear_errors!
|
21
|
+
@errors = []
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_error(*new_errors)
|
25
|
+
@errors ||= []
|
26
|
+
@errors.concat(new_errors.flatten)
|
27
|
+
end
|
28
|
+
alias_method :add_errors, :add_error
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'email_quality/validatability'
|
5
|
+
require 'email_quality/blacklist'
|
6
|
+
require 'email_quality/config'
|
7
|
+
require 'email_quality/domain'
|
8
|
+
require 'email_quality/address'
|
9
|
+
|
10
|
+
module EmailQuality
|
11
|
+
VERSION = '0.0.1'
|
12
|
+
class Error < StandardError; end
|
13
|
+
class MalformedEmailAddressError < Error; end
|
14
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/email_quality.rb'}"
|
9
|
+
puts "Loading email_quality gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: DrMark-email_quality
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dr. Mark Lane
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-19 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mime-types
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "1.15"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: diff-lcs
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.2
|
34
|
+
version:
|
35
|
+
description: Email Quality is a Ruby library for evaluating email addresses. It checks for format and to see if the domain is a Disposable Email Address (DEA).
|
36
|
+
email: tom@mojombo.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
|
+
files:
|
44
|
+
- History.txt
|
45
|
+
- Manifest.txt
|
46
|
+
- README.rdoc
|
47
|
+
- Rakefile
|
48
|
+
- lib/email_quality.rb
|
49
|
+
- lib/email_quality/address.rb
|
50
|
+
- lib/email_quality/blacklist.rb
|
51
|
+
- lib/email_quality/config.rb
|
52
|
+
- lib/email_quality/domain.rb
|
53
|
+
- lib/email_quality/validatability.rb
|
54
|
+
- script/console
|
55
|
+
- script/destroy
|
56
|
+
- script/generate
|
57
|
+
- test/test_email_quality.rb
|
58
|
+
- test/test_helper.rb
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://github.com/drmark/email_quality
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --charset=UTF-8
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: "0"
|
71
|
+
version:
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
version:
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.2.0
|
82
|
+
signing_key:
|
83
|
+
specification_version: 2
|
84
|
+
summary: This Ruby gem checks an email address for validity and identifies if it is from a Disposable Email Address (DEA) provider. Disposable email addresses are useful for privacy, but many sites wish to control access when using a DEA.
|
85
|
+
test_files: []
|
86
|
+
|