truemail 2.0.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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} +14 -3
- data/.github/ISSUE_TEMPLATE/question.md +22 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +3 -0
- data/.reek.yml +2 -0
- data/.rubocop.yml +69 -0
- data/CHANGELOG.md +86 -15
- data/CONTRIBUTING.md +15 -14
- data/Gemfile.lock +47 -41
- data/README.md +109 -4
- data/lib/truemail.rb +1 -1
- data/lib/truemail/configuration.rb +3 -2
- data/lib/truemail/core.rb +1 -1
- data/lib/truemail/log/serializer/base.rb +1 -0
- data/lib/truemail/log/serializer/validator_base.rb +5 -1
- data/lib/truemail/validate/mx.rb +1 -1
- data/lib/truemail/validate/smtp.rb +15 -5
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +8 -8
- metadata +43 -27
data/CONTRIBUTING.md
CHANGED
@@ -6,28 +6,28 @@ Following these guidelines helps to communicate that you respect the time of the
|
|
6
6
|
|
7
7
|
## Using the issue tracker
|
8
8
|
|
9
|
-
The issue tracker is the preferred channel for [bug reports](#
|
9
|
+
The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests).
|
10
10
|
|
11
|
-
|
12
|
-
## Bug/issue reports
|
11
|
+
## Issue/bug reports
|
13
12
|
|
14
|
-
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
15
|
-
Good bug reports are extremely helpful - thank you!
|
13
|
+
A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
|
16
14
|
|
17
|
-
Guidelines for bug reports:
|
15
|
+
Guidelines for issue/bug reports:
|
18
16
|
|
19
17
|
1. **Use the GitHub issue search** — check if the issue has already been reported
|
20
|
-
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or
|
21
|
-
3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
|
18
|
+
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or `develop` branch in the repository
|
19
|
+
3. Truemail [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
|
22
20
|
|
23
21
|
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
|
24
22
|
|
25
|
-
<a name="features"></a>
|
26
23
|
## Feature requests
|
27
24
|
|
28
25
|
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
|
29
26
|
|
30
|
-
|
27
|
+
## Questions
|
28
|
+
|
29
|
+
We're always open to a new conversations. So if you have any questions just ask us.
|
30
|
+
|
31
31
|
## Pull requests
|
32
32
|
|
33
33
|
Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
|
@@ -39,7 +39,8 @@ Please adhere to the coding conventions used throughout a project (indentation,
|
|
39
39
|
Guidelines for pull requests:
|
40
40
|
|
41
41
|
1. Truemail [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
|
42
|
-
2. Fork the repo
|
43
|
-
3. Run the tests. This is to make sure your starting point works
|
44
|
-
4.
|
45
|
-
5.
|
42
|
+
2. Fork the repo, checkout to `develop` branch
|
43
|
+
3. Run the tests. This is to make sure your starting point works
|
44
|
+
4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md)
|
45
|
+
5. Create a new branch and make your changes. This includes tests for features!
|
46
|
+
6. Push to your fork and submit a pull request to `develop` branch
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
truemail (2.
|
4
|
+
truemail (2.2.1)
|
5
5
|
simpleidn (~> 0.1.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -15,12 +15,16 @@ GEM
|
|
15
15
|
childprocess (4.0.0)
|
16
16
|
coderay (1.1.3)
|
17
17
|
colorize (0.8.1)
|
18
|
+
concurrent-ruby (1.1.7)
|
18
19
|
diff-lcs (1.4.4)
|
19
20
|
docile (1.3.2)
|
21
|
+
faker (2.15.1)
|
22
|
+
i18n (>= 1.6, < 2)
|
20
23
|
fasterer (0.8.3)
|
21
24
|
colorize (~> 0.7)
|
22
25
|
ruby_parser (>= 3.14.1)
|
23
|
-
|
26
|
+
i18n (1.8.5)
|
27
|
+
concurrent-ruby (~> 1.0)
|
24
28
|
iniparse (1.5.0)
|
25
29
|
json (2.3.1)
|
26
30
|
json_matchers (0.11.1)
|
@@ -28,11 +32,11 @@ GEM
|
|
28
32
|
json_schema (0.20.9)
|
29
33
|
kwalify (0.7.2)
|
30
34
|
method_source (1.0.0)
|
31
|
-
overcommit (0.
|
35
|
+
overcommit (0.57.0)
|
32
36
|
childprocess (>= 0.6.3, < 5)
|
33
37
|
iniparse (~> 1.4)
|
34
|
-
parallel (1.
|
35
|
-
parser (2.7.
|
38
|
+
parallel (1.20.1)
|
39
|
+
parser (2.7.2.0)
|
36
40
|
ast (~> 2.4.1)
|
37
41
|
pry (0.13.1)
|
38
42
|
coderay (~> 1.1)
|
@@ -40,45 +44,46 @@ GEM
|
|
40
44
|
pry-byebug (3.9.0)
|
41
45
|
byebug (~> 11.0)
|
42
46
|
pry (~> 0.13.0)
|
43
|
-
psych (3.
|
47
|
+
psych (3.2.0)
|
44
48
|
rainbow (3.0.0)
|
45
49
|
rake (13.0.1)
|
46
|
-
reek (6.0.
|
50
|
+
reek (6.0.2)
|
47
51
|
kwalify (~> 0.7.0)
|
48
52
|
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
49
|
-
psych (~> 3.1
|
53
|
+
psych (~> 3.1)
|
50
54
|
rainbow (>= 2.0, < 4.0)
|
51
|
-
regexp_parser (
|
55
|
+
regexp_parser (2.0.0)
|
52
56
|
rexml (3.2.4)
|
53
|
-
rspec (3.
|
54
|
-
rspec-core (~> 3.
|
55
|
-
rspec-expectations (~> 3.
|
56
|
-
rspec-mocks (~> 3.
|
57
|
-
rspec-core (3.
|
58
|
-
rspec-support (~> 3.
|
59
|
-
rspec-expectations (3.
|
57
|
+
rspec (3.10.0)
|
58
|
+
rspec-core (~> 3.10.0)
|
59
|
+
rspec-expectations (~> 3.10.0)
|
60
|
+
rspec-mocks (~> 3.10.0)
|
61
|
+
rspec-core (3.10.0)
|
62
|
+
rspec-support (~> 3.10.0)
|
63
|
+
rspec-expectations (3.10.0)
|
60
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-mocks (3.
|
65
|
+
rspec-support (~> 3.10.0)
|
66
|
+
rspec-mocks (3.10.0)
|
63
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-support (3.
|
66
|
-
rubocop (
|
68
|
+
rspec-support (~> 3.10.0)
|
69
|
+
rspec-support (3.10.0)
|
70
|
+
rubocop (1.5.2)
|
67
71
|
parallel (~> 1.10)
|
68
|
-
parser (>= 2.7.1.
|
72
|
+
parser (>= 2.7.1.5)
|
69
73
|
rainbow (>= 2.2.2, < 4.0)
|
70
|
-
regexp_parser (>= 1.
|
74
|
+
regexp_parser (>= 1.8, < 3.0)
|
71
75
|
rexml
|
72
|
-
rubocop-ast (>=
|
76
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
73
77
|
ruby-progressbar (~> 1.7)
|
74
78
|
unicode-display_width (>= 1.4.0, < 2.0)
|
75
|
-
rubocop-ast (
|
76
|
-
parser (>= 2.7.1.
|
77
|
-
rubocop-performance (1.
|
78
|
-
rubocop (>= 0.
|
79
|
+
rubocop-ast (1.3.0)
|
80
|
+
parser (>= 2.7.1.5)
|
81
|
+
rubocop-performance (1.9.1)
|
82
|
+
rubocop (>= 0.90.0, < 2.0)
|
79
83
|
rubocop-ast (>= 0.4.0)
|
80
|
-
rubocop-rspec (
|
81
|
-
rubocop (~> 0
|
84
|
+
rubocop-rspec (2.0.1)
|
85
|
+
rubocop (~> 1.0)
|
86
|
+
rubocop-ast (>= 1.1.0)
|
82
87
|
ruby-progressbar (1.10.1)
|
83
88
|
ruby_parser (3.15.0)
|
84
89
|
sexp_processor (~> 4.9)
|
@@ -91,9 +96,10 @@ GEM
|
|
91
96
|
simpleidn (0.1.1)
|
92
97
|
unf (~> 0.1.4)
|
93
98
|
thor (1.0.1)
|
94
|
-
truemail-rspec (0.
|
95
|
-
|
96
|
-
|
99
|
+
truemail-rspec (0.3.3)
|
100
|
+
faker (~> 2.15, >= 2.15.1)
|
101
|
+
rspec (~> 3.10)
|
102
|
+
truemail (~> 2.2)
|
97
103
|
unf (0.1.4)
|
98
104
|
unf_ext
|
99
105
|
unf_ext (0.0.7.7)
|
@@ -105,20 +111,20 @@ PLATFORMS
|
|
105
111
|
DEPENDENCIES
|
106
112
|
bundler (~> 1.16)
|
107
113
|
bundler-audit (~> 0.7.0.1)
|
114
|
+
faker (~> 2.15, >= 2.15.1)
|
108
115
|
fasterer (~> 0.8.3)
|
109
|
-
ffaker (~> 2.17)
|
110
116
|
json_matchers (~> 0.11.1)
|
111
|
-
overcommit (~> 0.
|
117
|
+
overcommit (~> 0.57.0)
|
112
118
|
pry-byebug (~> 3.9)
|
113
119
|
rake (~> 13.0, >= 13.0.1)
|
114
|
-
reek (~> 6.0, >= 6.0.
|
115
|
-
rspec (~> 3.
|
116
|
-
rubocop (~>
|
117
|
-
rubocop-performance (~> 1.
|
118
|
-
rubocop-rspec (~>
|
120
|
+
reek (~> 6.0, >= 6.0.2)
|
121
|
+
rspec (~> 3.10)
|
122
|
+
rubocop (~> 1.5, >= 1.5.2)
|
123
|
+
rubocop-performance (~> 1.9, >= 1.9.1)
|
124
|
+
rubocop-rspec (~> 2.0, >= 2.0.1)
|
119
125
|
simplecov (~> 0.17.1)
|
120
126
|
truemail!
|
121
|
-
truemail-rspec (~> 0.
|
127
|
+
truemail-rspec (~> 0.3.3)
|
122
128
|
|
123
129
|
BUNDLED WITH
|
124
130
|
1.16.6
|
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
|
2
2
|
|
3
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/0fea6d2e64d78d66b149/maintainability)](https://codeclimate.com/github/truemail-rb/truemail/maintainability)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/0fea6d2e64d78d66b149/maintainability)](https://codeclimate.com/github/truemail-rb/truemail/maintainability)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/0fea6d2e64d78d66b149/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail/test_coverage)
|
5
|
+
[![CircleCI](https://circleci.com/gh/truemail-rb/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail/tree/master)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail)
|
7
|
+
[![Downloads](https://img.shields.io/gem/dt/truemail.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail)
|
8
|
+
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=truemail&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=truemail&package-manager=bundler&version-scheme=semver)
|
9
|
+
[![Gitter](https://badges.gitter.im/truemail-rb/community.svg)](https://gitter.im/truemail-rb/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
10
|
+
[![GitHub](https://img.shields.io/github/license/truemail-rb/truemail)](LICENSE.txt)
|
11
|
+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
|
4
12
|
|
5
13
|
Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP. Be sure that email address valid and exists.
|
6
14
|
|
@@ -32,6 +40,7 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
|
|
32
40
|
- [RFC MX lookup flow](#rfc-mx-lookup-flow)
|
33
41
|
- [Not RFC MX lookup flow](#not-rfc-mx-lookup-flow)
|
34
42
|
- [SMTP validation](#smtp-validation)
|
43
|
+
- [SMTP fail fast enabled](#smtp-fail-fast-enabled)
|
35
44
|
- [SMTP safe check disabled](#smtp-safe-check-disabled)
|
36
45
|
- [SMTP safe check enabled](#smtp-safe-check-enabled)
|
37
46
|
- [Host audit features](#host-audit-features)
|
@@ -74,10 +83,12 @@ Also Truemail gem allows performing an audit of the host in which runs.
|
|
74
83
|
- Minimal runtime dependencies
|
75
84
|
- Supporting of internationalized emails ([EAI](https://en.wikipedia.org/wiki/Email_address#Internationalization))
|
76
85
|
- Whitelist/blacklist validation layers
|
86
|
+
- Ability to configure different MX/SMTP validation flows
|
77
87
|
- Simple SMTP debugger
|
78
88
|
- Event logger
|
79
89
|
- Host auditor tools (helps to detect common host problems interfering to proper email verification)
|
80
90
|
- JSON serializers
|
91
|
+
- Ability to use the library as independent stateless microservice ([Truemail Server](https://truemail-rb.org/truemail-rack))
|
81
92
|
|
82
93
|
## Requirements
|
83
94
|
|
@@ -121,6 +132,8 @@ You can use global gem configuration or custom independent configuration. Availa
|
|
121
132
|
- whitelisted domains
|
122
133
|
- whitelist validation
|
123
134
|
- blacklisted domains
|
135
|
+
- RFC MX lookup flow
|
136
|
+
- SMTP fail fast
|
124
137
|
- SMTP safe check
|
125
138
|
- event logger
|
126
139
|
- JSON serializer
|
@@ -146,10 +159,12 @@ Truemail.configure do |config|
|
|
146
159
|
# Optional parameter. You can override default regex pattern
|
147
160
|
config.smtp_error_body_pattern = /regex_pattern/
|
148
161
|
|
149
|
-
# Optional parameter. Connection timeout
|
162
|
+
# Optional parameter. Connection timeout in seconds.
|
163
|
+
# It is equal to 2 by default.
|
150
164
|
config.connection_timeout = 1
|
151
165
|
|
152
|
-
# Optional parameter. A SMTP server response timeout
|
166
|
+
# Optional parameter. A SMTP server response timeout in seconds.
|
167
|
+
# It is equal to 2 by default.
|
153
168
|
config.response_timeout = 1
|
154
169
|
|
155
170
|
# Optional parameter. Total of connection attempts. It is equal to 2 by default.
|
@@ -191,6 +206,13 @@ Truemail.configure do |config|
|
|
191
206
|
# By default this option is disabled.
|
192
207
|
config.not_rfc_mx_lookup_flow = true
|
193
208
|
|
209
|
+
# Optional parameter. This option will provide to use smtp fail fast behaviour. When
|
210
|
+
# smtp_fail_fast = true it means that truemail ends smtp validation session after first
|
211
|
+
# attempt on the first mx server in any fail cases (network connection/timeout error,
|
212
|
+
# smtp validation error). This feature helps to reduce total time of SMTP validation
|
213
|
+
# session up to 1 second. By default this option is disabled.
|
214
|
+
config.smtp_fail_fast = true
|
215
|
+
|
194
216
|
# Optional parameter. This option will be parse bodies of SMTP errors. It will be helpful
|
195
217
|
# if SMTP server does not return an exact answer that the email does not exist
|
196
218
|
# By default this option is disabled, available for SMTP validation only.
|
@@ -223,6 +245,7 @@ Truemail.configuration
|
|
223
245
|
@verifier_domain="somedomain.com",
|
224
246
|
@verifier_email="verifier@example.com",
|
225
247
|
@not_rfc_mx_lookup_flow=true,
|
248
|
+
@smtp_fail_fast=true,
|
226
249
|
@smtp_safe_check=true,
|
227
250
|
@logger=#<Truemail::Logger:0x0000557f837450b0
|
228
251
|
@event=:all, @file="/home/app/log/truemail.log", @stdout=true>>
|
@@ -252,6 +275,7 @@ Truemail.configuration
|
|
252
275
|
@verifier_domain="somedomain.com",
|
253
276
|
@verifier_email="verifier@example.com",
|
254
277
|
@not_rfc_mx_lookup_flow=true,
|
278
|
+
@smtp_fail_fast=true,
|
255
279
|
@smtp_safe_check=true,
|
256
280
|
@logger=#<Truemail::Logger:0x0000557f837450b0
|
257
281
|
@event=:all, @file="/home/app/log/truemail.log", @stdout=true>>
|
@@ -284,7 +308,6 @@ Truemail.host_audit('email@example.com', custom_configuration: custom_configurat
|
|
284
308
|
|
285
309
|
Please note, you should have global or custom configuration for use Truemail gem.
|
286
310
|
|
287
|
-
|
288
311
|
### Validation features
|
289
312
|
|
290
313
|
#### Whitelist/Blacklist check
|
@@ -336,6 +359,7 @@ Truemail.validate('email@white-domain.com')
|
|
336
359
|
@response_timeout=2,
|
337
360
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
338
361
|
@not_rfc_mx_lookup_flow=false,
|
362
|
+
@smtp_fail_fast=false,
|
339
363
|
@smtp_safe_check=false,
|
340
364
|
@validation_type_by_domain={"somedomain.com"=>:mx},
|
341
365
|
@verifier_domain="example.com",
|
@@ -382,6 +406,7 @@ Truemail.validate('email@white-domain.com', with: :regex)
|
|
382
406
|
@response_timeout=2,
|
383
407
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
384
408
|
@not_rfc_mx_lookup_flow=false,
|
409
|
+
@smtp_fail_fast=false,
|
385
410
|
@smtp_safe_check=false,
|
386
411
|
@validation_type_by_domain={},
|
387
412
|
@verifier_domain="example.com",
|
@@ -414,6 +439,7 @@ Truemail.validate('email@domain.com', with: :regex)
|
|
414
439
|
@response_timeout=2,
|
415
440
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
416
441
|
@not_rfc_mx_lookup_flow=false,
|
442
|
+
@smtp_fail_fast=false,
|
417
443
|
@smtp_safe_check=false,
|
418
444
|
@validation_type_by_domain={},
|
419
445
|
@verifier_domain="example.com",
|
@@ -448,6 +474,7 @@ Truemail.validate('email@black-domain.com')
|
|
448
474
|
@response_timeout=2,
|
449
475
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
450
476
|
@not_rfc_mx_lookup_flow=false,
|
477
|
+
@smtp_fail_fast=false,
|
451
478
|
@smtp_safe_check=false,
|
452
479
|
@validation_type_by_domain={},
|
453
480
|
@verifier_domain="example.com",
|
@@ -482,6 +509,7 @@ Truemail.validate('email@somedomain.com')
|
|
482
509
|
@response_timeout=2,
|
483
510
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
484
511
|
@not_rfc_mx_lookup_flow=false,
|
512
|
+
@smtp_fail_fast=false,
|
485
513
|
@smtp_safe_check=false,
|
486
514
|
@validation_type_by_domain={},
|
487
515
|
@verifier_domain="example.com",
|
@@ -532,6 +560,7 @@ Truemail.validate('email@example.com', with: :regex)
|
|
532
560
|
@response_timeout=2,
|
533
561
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
534
562
|
@not_rfc_mx_lookup_flow=false,
|
563
|
+
@smtp_fail_fast=false,
|
535
564
|
@smtp_safe_check=false,
|
536
565
|
@validation_type_by_domain={},
|
537
566
|
@verifier_domain="example.com",
|
@@ -574,6 +603,7 @@ Truemail.validate('email@example.com', with: :regex)
|
|
574
603
|
@response_timeout=2,
|
575
604
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
576
605
|
@not_rfc_mx_lookup_flow=false,
|
606
|
+
@smtp_fail_fast=false,
|
577
607
|
@smtp_safe_check=false,
|
578
608
|
@validation_type_by_domain={},
|
579
609
|
@verifier_domain="example.com",
|
@@ -627,6 +657,7 @@ Truemail.validate('email@example.com', with: :mx)
|
|
627
657
|
@response_timeout=2,
|
628
658
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
629
659
|
@not_rfc_mx_lookup_flow=false,
|
660
|
+
@smtp_fail_fast=false,
|
630
661
|
@smtp_safe_check=false,
|
631
662
|
@validation_type_by_domain={},
|
632
663
|
@verifier_domain="example.com",
|
@@ -671,6 +702,7 @@ Truemail.validate('email@example.com', with: :mx)
|
|
671
702
|
@response_timeout=2,
|
672
703
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
673
704
|
@not_rfc_mx_lookup_flow=true,
|
705
|
+
@smtp_fail_fast=false,
|
674
706
|
@smtp_safe_check=false,
|
675
707
|
@validation_type_by_domain={},
|
676
708
|
@verifier_domain="example.com",
|
@@ -692,6 +724,68 @@ If total count of MX servers is equal to one, `Truemail::Smtp` validator will us
|
|
692
724
|
|
693
725
|
By default, you don't need pass with-parameter to use it. Example of usage is specified below:
|
694
726
|
|
727
|
+
##### SMTP fail fast enabled
|
728
|
+
|
729
|
+
Truemail can use fail fast behaviour for SMTP validation layer. When `smtp_fail_fast = true` it means that `truemail` ends smtp validation session after first attempt on the first mx server in any fail cases (network connection/timeout error, smtp validation error). This feature helps to reduce total time of SMTP validation session up to 1 second.
|
730
|
+
|
731
|
+
```ruby
|
732
|
+
require 'truemail'
|
733
|
+
|
734
|
+
Truemail.configure do |config|
|
735
|
+
config.verifier_email = 'verifier@example.com'
|
736
|
+
config.smtp_fail_fast = true
|
737
|
+
end
|
738
|
+
|
739
|
+
Truemail.validate('email@example.com')
|
740
|
+
|
741
|
+
# SMTP validation failed, smtp fail fast validation scenario
|
742
|
+
=> #<Truemail::Validator:0x00007fdc4504f460
|
743
|
+
@result=
|
744
|
+
#<struct Truemail::Validator::Result
|
745
|
+
success=false,
|
746
|
+
email="email@example.com",
|
747
|
+
domain="example.com",
|
748
|
+
mail_servers=["127.0.1.1", "127.0.1.2", "127.0.1.3"], # there are 3 mail servers in a row
|
749
|
+
errors={:smtp=>"smtp error"},
|
750
|
+
smtp_debug=
|
751
|
+
[#<Truemail::Validate::Smtp::Request:0x00007fdc43150b90 # but iteration has been stopped after the first failure
|
752
|
+
@attempts=nil,
|
753
|
+
@configuration=
|
754
|
+
#<Truemail::Validate::Smtp::Request::Configuration:0x00007fdc43150b18
|
755
|
+
@connection_timeout=2,
|
756
|
+
@response_timeout=2,
|
757
|
+
@verifier_domain="example.com",
|
758
|
+
@verifier_email="verifier@example.com">,
|
759
|
+
@email="email@example.com",
|
760
|
+
@host="127.0.1.1",
|
761
|
+
@response=
|
762
|
+
#<struct Truemail::Validate::Smtp::Response
|
763
|
+
port_opened=false,
|
764
|
+
connection=nil,
|
765
|
+
helo=nil,
|
766
|
+
mailfrom=nil,
|
767
|
+
rcptto=nil,
|
768
|
+
errors={}>>],
|
769
|
+
configuration=
|
770
|
+
#<Truemail::Configuration:0x00007fdc4504f5c8
|
771
|
+
@blacklisted_domains=[],
|
772
|
+
@connection_attempts=2,
|
773
|
+
@connection_timeout=2,
|
774
|
+
@default_validation_type=:smtp,
|
775
|
+
@email_pattern=/(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@((?i-mx:[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}))\z)/,
|
776
|
+
@not_rfc_mx_lookup_flow=false,
|
777
|
+
@response_timeout=2,
|
778
|
+
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
779
|
+
@smtp_fail_fast=true,
|
780
|
+
@smtp_safe_check=false,
|
781
|
+
@validation_type_by_domain={},
|
782
|
+
@verifier_domain="example.com",
|
783
|
+
@verifier_email="verifier@example.com",
|
784
|
+
@whitelist_validation=false,
|
785
|
+
@whitelisted_domains=[]>>,
|
786
|
+
@validation_type=:smtp>
|
787
|
+
```
|
788
|
+
|
695
789
|
##### SMTP safe check disabled
|
696
790
|
|
697
791
|
With `smtp_safe_check = false`
|
@@ -725,6 +819,7 @@ Truemail.validate('email@example.com')
|
|
725
819
|
@response_timeout=2,
|
726
820
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
727
821
|
@not_rfc_mx_lookup_flow=false,
|
822
|
+
@smtp_fail_fast=false,
|
728
823
|
@smtp_safe_check=false,
|
729
824
|
@validation_type_by_domain={},
|
730
825
|
@verifier_domain="example.com",
|
@@ -774,6 +869,7 @@ Truemail.validate('email@example.com')
|
|
774
869
|
@response_timeout=2,
|
775
870
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
776
871
|
@not_rfc_mx_lookup_flow=false,
|
872
|
+
@smtp_fail_fast=false,
|
777
873
|
@smtp_safe_check=false,
|
778
874
|
@validation_type_by_domain={},
|
779
875
|
@verifier_domain="example.com",
|
@@ -835,6 +931,7 @@ Truemail.validate('email@example.com')
|
|
835
931
|
@response_timeout=2,
|
836
932
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
837
933
|
@not_rfc_mx_lookup_flow=false,
|
934
|
+
@smtp_fail_fast=false,
|
838
935
|
@smtp_safe_check=false,
|
839
936
|
@validation_type_by_domain={},
|
840
937
|
@verifier_domain="example.com",
|
@@ -881,6 +978,7 @@ Truemail.validate('email@example.com')
|
|
881
978
|
@response_timeout=2,
|
882
979
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
883
980
|
@not_rfc_mx_lookup_flow=false,
|
981
|
+
@smtp_fail_fast=false,
|
884
982
|
@smtp_safe_check=false,
|
885
983
|
@validation_type_by_domain={},
|
886
984
|
@verifier_domain="example.com",
|
@@ -928,6 +1026,7 @@ Truemail.host_audit
|
|
928
1026
|
@response_timeout=2,
|
929
1027
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
930
1028
|
@not_rfc_mx_lookup_flow=false,
|
1029
|
+
@smtp_fail_fast=false,
|
931
1030
|
@smtp_safe_check=false,
|
932
1031
|
@validation_type_by_domain={},
|
933
1032
|
@verifier_domain="example.com",
|
@@ -954,6 +1053,7 @@ Truemail.host_audit
|
|
954
1053
|
@response_timeout=2,
|
955
1054
|
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
956
1055
|
@not_rfc_mx_lookup_flow=false,
|
1056
|
+
@smtp_fail_fast=false,
|
957
1057
|
@smtp_safe_check=false,
|
958
1058
|
@validation_type_by_domain={},
|
959
1059
|
@verifier_domain="example.com",
|
@@ -1002,6 +1102,7 @@ Truemail::Log::Serializer::AuditorJson.call(Truemail.host_audit)
|
|
1002
1102
|
"whitelisted_domains": null,
|
1003
1103
|
"blacklisted_domains": null,
|
1004
1104
|
"not_rfc_mx_lookup_flow": false,
|
1105
|
+
"smtp_fail_fast": false,
|
1005
1106
|
"smtp_safe_check": false,
|
1006
1107
|
"email_pattern": "default gem value",
|
1007
1108
|
"smtp_error_body_pattern": "default gem value"
|
@@ -1040,6 +1141,7 @@ Truemail::Log::Serializer::ValidatorJson.call(Truemail.validate('nonexistent_ema
|
|
1040
1141
|
"whitelisted_domains": null,
|
1041
1142
|
"blacklisted_domains": null,
|
1042
1143
|
"not_rfc_mx_lookup_flow": false,
|
1144
|
+
"smtp_fail_fast": false,
|
1043
1145
|
"smtp_safe_check": false,
|
1044
1146
|
"email_pattern": "default gem value",
|
1045
1147
|
"smtp_error_body_pattern": "default gem value"
|
@@ -1080,6 +1182,7 @@ Truemail.host_audit.as_json
|
|
1080
1182
|
"whitelisted_domains": null,
|
1081
1183
|
"blacklisted_domains": null,
|
1082
1184
|
"not_rfc_mx_lookup_flow": false,
|
1185
|
+
"smtp_fail_fast": false,
|
1083
1186
|
"smtp_safe_check": false,
|
1084
1187
|
"email_pattern": "default gem value",
|
1085
1188
|
"smtp_error_body_pattern": "default gem value"
|
@@ -1115,6 +1218,7 @@ Truemail.validate('nonexistent_email@bestweb.com.ua').as_json
|
|
1115
1218
|
"whitelisted_domains": null,
|
1116
1219
|
"blacklisted_domains": null,
|
1117
1220
|
"not_rfc_mx_lookup_flow": false,
|
1221
|
+
"smtp_fail_fast": false,
|
1118
1222
|
"smtp_safe_check": false,
|
1119
1223
|
"email_pattern": "default gem value",
|
1120
1224
|
"smtp_error_body_pattern": "default gem value"
|
@@ -1165,6 +1269,7 @@ All Truemail solutions: https://truemail-rb.org
|
|
1165
1269
|
| [truemail-rack-docker](https://github.com/truemail-rb/truemail-rack-docker-image) | docker image | Lightweight rack based web API [dockerized image](https://hub.docker.com/r/truemail/truemail-rack) :whale: of Truemail server |
|
1166
1270
|
| [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
|
1167
1271
|
| [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
|
1272
|
+
| [truemail-java-client](https://github.com/truemail-rb/truemail-java-client) | java lib | Web API Java client for Truemail Server |
|
1168
1273
|
| [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
|
1169
1274
|
|
1170
1275
|
## Contributing
|