email_verifier 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
-
To get info about realness of given email address, email_verifier connects with a mail server that email's domain points to and pretends to send an email. Some smtp servers will not allow you to do this if you will not present yourself as a real user.
|
29
|
+
To get info about realness of given email address, email_verifier connects with a mail server that email's domain points to and pretends to send an email. Some smtp servers will not allow you to do this if you will not present yourself as a real user.
|
30
30
|
|
31
31
|
First thing you need to set up is placing something like this either in initializer or in application.rb file:
|
32
32
|
|
@@ -35,7 +35,7 @@ First thing you need to set up is placing something like this either in initiali
|
|
35
35
|
end
|
36
36
|
|
37
37
|
Then just put this in your model e. g:
|
38
|
-
|
38
|
+
|
39
39
|
validates_email_realness_of :email
|
40
40
|
|
41
41
|
Or - if you'd like to use it outside of your models:
|
@@ -69,6 +69,8 @@ Please send questions to [kamil@endpoint.com](mailto:kamil@endpoint.com)
|
|
69
69
|
|
70
70
|
* Maciej Walusiak ([https://github.com/Rabsztok]())
|
71
71
|
* Francesco Gnarra ([https://github.com/francescognarra]())
|
72
|
+
* Stefan Wienert ([https://github.com/zealot128]())
|
73
|
+
* [https://github.com/mzabaljauregui]()
|
72
74
|
|
73
75
|
## Contributing yourself
|
74
76
|
|
@@ -55,7 +55,13 @@ class EmailVerifier::Checker
|
|
55
55
|
|
56
56
|
def verify
|
57
57
|
self.mailfrom @user_email
|
58
|
-
self.rcptto(@email)
|
58
|
+
self.rcptto(@email).tap do
|
59
|
+
close_connection
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def close_connection
|
64
|
+
@smtp.finish if @smtp && @smtp.started?
|
59
65
|
end
|
60
66
|
|
61
67
|
def mailfrom(address)
|
@@ -89,5 +95,4 @@ class EmailVerifier::Checker
|
|
89
95
|
raise EmailVerifier::FailureException.new "Mail server responded with #{smtp_return.status} when we were expecting 250"
|
90
96
|
end
|
91
97
|
end
|
92
|
-
|
93
98
|
end
|
@@ -2,7 +2,7 @@ require "active_record"
|
|
2
2
|
|
3
3
|
module EmailVerifier
|
4
4
|
module ValidatesEmailRealness
|
5
|
-
|
5
|
+
|
6
6
|
module Validator
|
7
7
|
class EmailRealnessValidator < ActiveModel::EachValidator
|
8
8
|
def validate_each(record, attribute, value)
|
@@ -14,13 +14,13 @@ module EmailVerifier
|
|
14
14
|
record.errors.add attribute, I18n.t('errors.messages.email_verifier.no_mail_server')
|
15
15
|
rescue EmailVerifier::FailureException
|
16
16
|
record.errors.add attribute, I18n.t('errors.messages.email_verifier.failure')
|
17
|
-
|
18
|
-
|
17
|
+
rescue Exception
|
18
|
+
record.errors.add attribute, I18n.t('errors.messages.email_verifier.exception')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
module ClassMethods
|
25
25
|
def validates_email_realness_of(*attr_names)
|
26
26
|
validates_with ActiveRecord::Base::EmailRealnessValidator, _merge_attributes(attr_names)
|
data/locales/de.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
email_verifier:
|
5
|
+
email_not_real: muss eine echte Mail-Adresse sein
|
6
|
+
out_of_mail_server: Mail-Server ist nicht erreichbar
|
7
|
+
no_mail_server: verwendet eine Domain, die keine E-Mails annimmt
|
8
|
+
failure: konnte nicht auf Korrektheit überprüft werden
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_verifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/email_verifier/exceptions.rb
|
63
63
|
- lib/email_verifier/validates_email_realness.rb
|
64
64
|
- lib/email_verifier/version.rb
|
65
|
+
- locales/de.yml
|
65
66
|
- locales/en.yml
|
66
67
|
- locales/it.yml
|
67
68
|
- locales/pl.yml
|
@@ -78,18 +79,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
79
|
- - ! '>='
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
version: '0'
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
hash: 548687799499873481
|
84
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
84
|
requirements:
|
87
85
|
- - ! '>='
|
88
86
|
- !ruby/object:Gem::Version
|
89
87
|
version: '0'
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
hash: 548687799499873481
|
93
88
|
requirements: []
|
94
89
|
rubyforge_project:
|
95
90
|
rubygems_version: 1.8.23
|
@@ -97,3 +92,4 @@ signing_key:
|
|
97
92
|
specification_version: 3
|
98
93
|
summary: Helper utility checking if given email address exists or not
|
99
94
|
test_files: []
|
95
|
+
has_rdoc:
|