truemail 1.9.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.codeclimate.yml +1 -1
- data/.github/BRANCH_NAMING_CONVENTION.md +36 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- data/.github/{ISSUE_TEMPLATE.md → ISSUE_TEMPLATE/issue_report.md} +16 -5
- data/.github/ISSUE_TEMPLATE/question.md +22 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +4 -1
- data/.reek.yml +1 -0
- data/.rubocop.yml +51 -0
- data/CHANGELOG.md +102 -27
- data/CONTRIBUTING.md +15 -14
- data/Gemfile.lock +33 -32
- data/README.md +127 -31
- data/lib/truemail/configuration.rb +2 -1
- data/lib/truemail/core.rb +1 -1
- data/lib/truemail/validate/mx.rb +1 -1
- data/lib/truemail/validate/smtp.rb +15 -5
- data/lib/truemail/validate/smtp/request.rb +2 -3
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +9 -9
- metadata +21 -23
@@ -21,7 +21,7 @@ module Truemail
|
|
21
21
|
:blacklisted_domains,
|
22
22
|
:logger
|
23
23
|
|
24
|
-
attr_accessor :whitelist_validation, :not_rfc_mx_lookup_flow, :smtp_safe_check
|
24
|
+
attr_accessor :whitelist_validation, :not_rfc_mx_lookup_flow, :smtp_fail_fast, :smtp_safe_check
|
25
25
|
|
26
26
|
def initialize(&block)
|
27
27
|
instance_initializer.each do |instace_variable, value|
|
@@ -102,6 +102,7 @@ module Truemail
|
|
102
102
|
whitelist_validation: false,
|
103
103
|
blacklisted_domains: [],
|
104
104
|
not_rfc_mx_lookup_flow: false,
|
105
|
+
smtp_fail_fast: false,
|
105
106
|
smtp_safe_check: false
|
106
107
|
}
|
107
108
|
end
|
data/lib/truemail/core.rb
CHANGED
@@ -32,7 +32,7 @@ module Truemail
|
|
32
32
|
|
33
33
|
module RegexConstant
|
34
34
|
REGEX_DOMAIN = /[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}/i.freeze
|
35
|
-
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w
|
35
|
+
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@(#{REGEX_DOMAIN})\z)/.freeze
|
36
36
|
REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
|
37
37
|
REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
|
38
38
|
REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze
|
data/lib/truemail/validate/mx.rb
CHANGED
@@ -24,13 +24,23 @@ module Truemail
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def
|
28
|
-
|
27
|
+
def fail_fast?
|
28
|
+
configuration.smtp_fail_fast
|
29
|
+
end
|
30
|
+
|
31
|
+
def filtered_mail_servers_by_fail_fast_scenario
|
32
|
+
fail_fast? ? mail_servers.first(1) : mail_servers
|
29
33
|
end
|
30
34
|
|
31
35
|
def attempts
|
32
|
-
@attempts ||=
|
33
|
-
|
36
|
+
@attempts ||= begin
|
37
|
+
return {} if fail_fast? || !mail_servers.one?
|
38
|
+
{ attempts: configuration.connection_attempts }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def request
|
43
|
+
smtp_results.last
|
34
44
|
end
|
35
45
|
|
36
46
|
def rcptto_error
|
@@ -38,7 +48,7 @@ module Truemail
|
|
38
48
|
end
|
39
49
|
|
40
50
|
def establish_smtp_connection
|
41
|
-
|
51
|
+
filtered_mail_servers_by_fail_fast_scenario.each do |mail_server|
|
42
52
|
smtp_results << Truemail::Validate::Smtp::Request.new(
|
43
53
|
configuration: configuration, host: mail_server, email: result.punycode_email, **attempts
|
44
54
|
)
|
@@ -31,8 +31,8 @@ module Truemail
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run
|
34
|
-
session.start do |smtp_request|
|
35
|
-
response.connection = true
|
34
|
+
session.start(configuration.verifier_domain) do |smtp_request|
|
35
|
+
response.connection = response.helo = true
|
36
36
|
smtp_handshakes(smtp_request, response)
|
37
37
|
end
|
38
38
|
rescue => error
|
@@ -83,7 +83,6 @@ module Truemail
|
|
83
83
|
|
84
84
|
def session_data
|
85
85
|
{
|
86
|
-
helo: configuration.verifier_domain,
|
87
86
|
mailfrom: configuration.verifier_email,
|
88
87
|
rcptto: email
|
89
88
|
}
|
data/lib/truemail/version.rb
CHANGED
data/truemail.gemspec
CHANGED
@@ -13,15 +13,15 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = %(truemail)
|
14
14
|
spec.description = %(Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP.)
|
15
15
|
|
16
|
-
spec.homepage = 'https://github.com/
|
16
|
+
spec.homepage = 'https://github.com/truemail-rb/truemail'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
19
|
spec.metadata = {
|
20
20
|
'homepage_uri' => 'https://truemail-rb.org',
|
21
|
-
'changelog_uri' => 'https://github.com/
|
22
|
-
'source_code_uri' => 'https://github.com/
|
21
|
+
'changelog_uri' => 'https://github.com/truemail-rb/truemail/blob/master/CHANGELOG.md',
|
22
|
+
'source_code_uri' => 'https://github.com/truemail-rb/truemail',
|
23
23
|
'documentation_uri' => 'https://truemail-rb.org/truemail-gem',
|
24
|
-
'bug_tracker_uri' => 'https://github.com/
|
24
|
+
'bug_tracker_uri' => 'https://github.com/truemail-rb/truemail/issues'
|
25
25
|
}
|
26
26
|
|
27
27
|
spec.required_ruby_version = '>= 2.5.0'
|
@@ -38,14 +38,14 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'fasterer', '~> 0.8.3'
|
39
39
|
spec.add_development_dependency 'ffaker', '~> 2.17'
|
40
40
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
41
|
-
spec.add_development_dependency 'overcommit', '~> 0.
|
41
|
+
spec.add_development_dependency 'overcommit', '~> 0.57.0'
|
42
42
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
43
43
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
44
|
-
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.
|
45
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
46
|
-
spec.add_development_dependency 'rubocop', '~>
|
44
|
+
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.2'
|
45
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
46
|
+
spec.add_development_dependency 'rubocop', '~> 1.3'
|
47
47
|
spec.add_development_dependency 'rubocop-performance', '~> 1.8', '>= 1.8.1'
|
48
|
-
spec.add_development_dependency 'rubocop-rspec', '~>
|
48
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
49
49
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
50
50
|
spec.add_development_dependency 'truemail-rspec', '~> 0.2.1'
|
51
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.57.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.57.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry-byebug
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
version: '6.0'
|
152
152
|
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: 6.0.
|
154
|
+
version: 6.0.2
|
155
155
|
type: :development
|
156
156
|
prerelease: false
|
157
157
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -161,35 +161,35 @@ dependencies:
|
|
161
161
|
version: '6.0'
|
162
162
|
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version: 6.0.
|
164
|
+
version: 6.0.2
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
166
|
name: rspec
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '3.
|
171
|
+
version: '3.10'
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '3.
|
178
|
+
version: '3.10'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: rubocop
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - "~>"
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
185
|
+
version: '1.3'
|
186
186
|
type: :development
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - "~>"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: '1.3'
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: rubocop-performance
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,20 +216,14 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: 1.43.2
|
219
|
+
version: '2.0'
|
223
220
|
type: :development
|
224
221
|
prerelease: false
|
225
222
|
version_requirements: !ruby/object:Gem::Requirement
|
226
223
|
requirements:
|
227
224
|
- - "~>"
|
228
225
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
230
|
-
- - ">="
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: 1.43.2
|
226
|
+
version: '2.0'
|
233
227
|
- !ruby/object:Gem::Dependency
|
234
228
|
name: simplecov
|
235
229
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,7 +262,11 @@ extra_rdoc_files: []
|
|
268
262
|
files:
|
269
263
|
- ".circleci/config.yml"
|
270
264
|
- ".codeclimate.yml"
|
271
|
-
- ".github/
|
265
|
+
- ".github/BRANCH_NAMING_CONVENTION.md"
|
266
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
267
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
268
|
+
- ".github/ISSUE_TEMPLATE/issue_report.md"
|
269
|
+
- ".github/ISSUE_TEMPLATE/question.md"
|
272
270
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
273
271
|
- ".gitignore"
|
274
272
|
- ".overcommit.yml"
|
@@ -315,15 +313,15 @@ files:
|
|
315
313
|
- lib/truemail/worker.rb
|
316
314
|
- lib/truemail/wrapper.rb
|
317
315
|
- truemail.gemspec
|
318
|
-
homepage: https://github.com/
|
316
|
+
homepage: https://github.com/truemail-rb/truemail
|
319
317
|
licenses:
|
320
318
|
- MIT
|
321
319
|
metadata:
|
322
320
|
homepage_uri: https://truemail-rb.org
|
323
|
-
changelog_uri: https://github.com/
|
324
|
-
source_code_uri: https://github.com/
|
321
|
+
changelog_uri: https://github.com/truemail-rb/truemail/blob/master/CHANGELOG.md
|
322
|
+
source_code_uri: https://github.com/truemail-rb/truemail
|
325
323
|
documentation_uri: https://truemail-rb.org/truemail-gem
|
326
|
-
bug_tracker_uri: https://github.com/
|
324
|
+
bug_tracker_uri: https://github.com/truemail-rb/truemail/issues
|
327
325
|
post_install_message:
|
328
326
|
rdoc_options: []
|
329
327
|
require_paths:
|