truemail 1.9.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests).
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
- <a name="bugs"></a>
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** &mdash; check if the issue has already been reported
20
- 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository
21
- 3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
18
+ 2. **Check if the issue has been fixed** &mdash; 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
- <a name="pull-requests"></a>
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. Tests can be run via ```rspec```
44
- 4. Create a new branch and make your changes. This includes tests for features!
45
- 5. Push to your fork and submit a pull request
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (1.9.2)
4
+ truemail (2.2.0)
5
5
  simpleidn (~> 0.1.1)
6
6
 
7
7
  GEM
@@ -28,11 +28,11 @@ GEM
28
28
  json_schema (0.20.9)
29
29
  kwalify (0.7.2)
30
30
  method_source (1.0.0)
31
- overcommit (0.55.0)
31
+ overcommit (0.57.0)
32
32
  childprocess (>= 0.6.3, < 5)
33
33
  iniparse (~> 1.4)
34
- parallel (1.19.2)
35
- parser (2.7.1.4)
34
+ parallel (1.20.0)
35
+ parser (2.7.2.0)
36
36
  ast (~> 2.4.1)
37
37
  pry (0.13.1)
38
38
  coderay (~> 1.1)
@@ -40,45 +40,46 @@ GEM
40
40
  pry-byebug (3.9.0)
41
41
  byebug (~> 11.0)
42
42
  pry (~> 0.13.0)
43
- psych (3.1.0)
43
+ psych (3.2.0)
44
44
  rainbow (3.0.0)
45
45
  rake (13.0.1)
46
- reek (6.0.1)
46
+ reek (6.0.2)
47
47
  kwalify (~> 0.7.0)
48
48
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
49
- psych (~> 3.1.0)
49
+ psych (~> 3.1)
50
50
  rainbow (>= 2.0, < 4.0)
51
- regexp_parser (1.8.0)
51
+ regexp_parser (1.8.2)
52
52
  rexml (3.2.4)
53
- rspec (3.9.0)
54
- rspec-core (~> 3.9.0)
55
- rspec-expectations (~> 3.9.0)
56
- rspec-mocks (~> 3.9.0)
57
- rspec-core (3.9.2)
58
- rspec-support (~> 3.9.3)
59
- rspec-expectations (3.9.2)
53
+ rspec (3.10.0)
54
+ rspec-core (~> 3.10.0)
55
+ rspec-expectations (~> 3.10.0)
56
+ rspec-mocks (~> 3.10.0)
57
+ rspec-core (3.10.0)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-expectations (3.10.0)
60
60
  diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.9.0)
62
- rspec-mocks (3.9.1)
61
+ rspec-support (~> 3.10.0)
62
+ rspec-mocks (3.10.0)
63
63
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.9.0)
65
- rspec-support (3.9.3)
66
- rubocop (0.91.0)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-support (3.10.0)
66
+ rubocop (1.3.0)
67
67
  parallel (~> 1.10)
68
- parser (>= 2.7.1.1)
68
+ parser (>= 2.7.1.5)
69
69
  rainbow (>= 2.2.2, < 4.0)
70
- regexp_parser (>= 1.7)
70
+ regexp_parser (>= 1.8)
71
71
  rexml
72
- rubocop-ast (>= 0.4.0, < 1.0)
72
+ rubocop-ast (>= 1.1.1)
73
73
  ruby-progressbar (~> 1.7)
74
74
  unicode-display_width (>= 1.4.0, < 2.0)
75
- rubocop-ast (0.4.2)
76
- parser (>= 2.7.1.4)
75
+ rubocop-ast (1.1.1)
76
+ parser (>= 2.7.1.5)
77
77
  rubocop-performance (1.8.1)
78
78
  rubocop (>= 0.87.0)
79
79
  rubocop-ast (>= 0.4.0)
80
- rubocop-rspec (1.43.2)
81
- rubocop (~> 0.87)
80
+ rubocop-rspec (2.0.0)
81
+ rubocop (~> 1.0)
82
+ rubocop-ast (>= 1.1.0)
82
83
  ruby-progressbar (1.10.1)
83
84
  ruby_parser (3.15.0)
84
85
  sexp_processor (~> 4.9)
@@ -108,14 +109,14 @@ DEPENDENCIES
108
109
  fasterer (~> 0.8.3)
109
110
  ffaker (~> 2.17)
110
111
  json_matchers (~> 0.11.1)
111
- overcommit (~> 0.55.0)
112
+ overcommit (~> 0.57.0)
112
113
  pry-byebug (~> 3.9)
113
114
  rake (~> 13.0, >= 13.0.1)
114
- reek (~> 6.0, >= 6.0.1)
115
- rspec (~> 3.9)
116
- rubocop (~> 0.91.0)
115
+ reek (~> 6.0, >= 6.0.2)
116
+ rspec (~> 3.10)
117
+ rubocop (~> 1.3)
117
118
  rubocop-performance (~> 1.8, >= 1.8.1)
118
- rubocop-rspec (~> 1.43, >= 1.43.2)
119
+ rubocop-rspec (~> 2.0)
119
120
  simplecov (~> 0.17.1)
120
121
  truemail!
121
122
  truemail-rspec (~> 0.2.1)
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
- ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
2
-
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/maintainability)](https://codeclimate.com/github/rubygarage/truemail/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/test_coverage)](https://codeclimate.com/github/rubygarage/truemail/test_coverage) [![CircleCI](https://circleci.com/gh/rubygarage/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/rubygarage/truemail/tree/master) [![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail) [![Downloads](https://img.shields.io/gem/dt/truemail.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail) [![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) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
1
+ # ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
2
+
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,13 +132,15 @@ 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
127
140
 
128
141
  #### Setting global configuration
129
142
 
130
- To have an access for ```Truemail.configuration``` and gem configuration features, you must configure it first as in the example below:
143
+ To have an access for `Truemail.configuration` and gem configuration features, you must configure it first as in the example below:
131
144
 
132
145
  ```ruby
133
146
  require 'truemail'
@@ -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 is equal to 2 ms by default.
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 is equal to 2 ms by default.
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,16 +308,16 @@ 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
291
314
 
292
- Whitelist/Blacklist check is zero validation level. You can define white and black list domains. It means that validation of email which contains whitelisted domain always will return ```true```, and for blacklisted domain will return ```false```.
315
+ Whitelist/Blacklist check is zero validation level. You can define white and black list domains. It means that validation of email which contains whitelisted domain always will return `true`, and for blacklisted domain will return `false`.
293
316
 
294
- Please note, other validations will not processed even if it was defined in ```validation_type_for```.
317
+ Please note, other validations will not processed even if it was defined in `validation_type_for`.
295
318
 
296
319
  **Sequence of domain list check:**
320
+
297
321
  1. Whitelist check
298
322
  2. Whitelist validation check
299
323
  3. Blacklist check
@@ -335,6 +359,7 @@ Truemail.validate('email@white-domain.com')
335
359
  @response_timeout=2,
336
360
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
337
361
  @not_rfc_mx_lookup_flow=false,
362
+ @smtp_fail_fast=false,
338
363
  @smtp_safe_check=false,
339
364
  @validation_type_by_domain={"somedomain.com"=>:mx},
340
365
  @verifier_domain="example.com",
@@ -356,8 +381,7 @@ Truemail.configure do |config|
356
381
  end
357
382
  ```
358
383
 
359
- When email domain in whitelist and ```whitelist_validation``` is sets equal to ```true``` validation type will be passed to other validators.
360
- Validation of email which not contains whitelisted domain always will return ```false```.
384
+ When email domain in whitelist and `whitelist_validation` is sets equal to `true` validation type will be passed to other validators. Validation of email which not contains whitelisted domain always will return `false`.
361
385
 
362
386
  ###### Email has whitelisted domain
363
387
 
@@ -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",
@@ -459,7 +486,7 @@ Truemail.validate('email@black-domain.com')
459
486
 
460
487
  ##### Duplication case
461
488
 
462
- Validation result for this email returns ```true```, because it was found in whitelisted domains list first. Also ```validation_type``` for this case will be redefined.
489
+ Validation result for this email returns `true`, because it was found in whitelisted domains list first. Also `validation_type` for this case will be redefined.
463
490
 
464
491
  ```ruby
465
492
  Truemail.validate('email@somedomain.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",
@@ -591,7 +621,7 @@ In fact it's DNS validation because it checks not MX records only. DNS validatio
591
621
  [Whitelist/Blacklist] -> [Regex validation] -> [MX validation]
592
622
  ```
593
623
 
594
- Please note, Truemail MX validator [not performs](https://github.com/rubygarage/truemail/issues/26) strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
624
+ Please note, Truemail MX validator [not performs](https://github.com/truemail-rb/truemail/issues/26) strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
595
625
 
596
626
  ##### RFC MX lookup flow
597
627
 
@@ -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",
@@ -688,13 +720,75 @@ SMTP validation is a final, third validation level. This type of validation trie
688
720
  [Whitelist/Blacklist] -> [Regex validation] -> [MX validation] -> [SMTP validation]
689
721
  ```
690
722
 
691
- If total count of MX servers is equal to one, ```Truemail::Smtp``` validator will use value from ```Truemail.configuration.connection_attempts``` as connection attempts. By default it's equal 2.
723
+ If total count of MX servers is equal to one, `Truemail::Smtp` validator will use value from `Truemail.configuration.connection_attempts` as connection attempts. By default it's equal `2`.
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
- With ```smtp_safe_check = false```
791
+ With `smtp_safe_check = false`
698
792
 
699
793
  ```ruby
700
794
  require 'truemail'
@@ -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",
@@ -757,10 +852,7 @@ Truemail.validate('email@example.com')
757
852
  #<struct Truemail::Validate::Smtp::Response
758
853
  port_opened=true,
759
854
  connection=true,
760
- helo=
761
- #<Net::SMTP::Response:0x0000000002d5aca8
762
- @status="250",
763
- @string="250 127.0.1.1 Hello example.com\n">,
855
+ helo=true,
764
856
  mailfrom=
765
857
  #<Net::SMTP::Response:0x0000000002d5a618
766
858
  @status="250",
@@ -777,6 +869,7 @@ Truemail.validate('email@example.com')
777
869
  @response_timeout=2,
778
870
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
779
871
  @not_rfc_mx_lookup_flow=false,
872
+ @smtp_fail_fast=false,
780
873
  @smtp_safe_check=false,
781
874
  @validation_type_by_domain={},
782
875
  @verifier_domain="example.com",
@@ -788,7 +881,7 @@ Truemail.validate('email@example.com')
788
881
 
789
882
  ##### SMTP safe check enabled
790
883
 
791
- With ```smtp_safe_check = true```
884
+ With `smtp_safe_check = true`
792
885
 
793
886
  ```ruby
794
887
  require 'truemail'
@@ -824,10 +917,7 @@ Truemail.validate('email@example.com')
824
917
  #<struct Truemail::Validate::Smtp::Response
825
918
  port_opened=true,
826
919
  connection=false,
827
- helo=
828
- #<Net::SMTP::Response:0x0000000002c934c8
829
- @status="250",
830
- @string="250 127.0.1.1\n">,
920
+ helo=true,
831
921
  mailfrom=false,
832
922
  rcptto=nil,
833
923
  errors={:mailfrom=>"554 5.7.1 Client host blocked\n", :connection=>"server dropped connection after response"}>>,]>,
@@ -841,6 +931,7 @@ Truemail.validate('email@example.com')
841
931
  @response_timeout=2,
842
932
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
843
933
  @not_rfc_mx_lookup_flow=false,
934
+ @smtp_fail_fast=false,
844
935
  @smtp_safe_check=false,
845
936
  @validation_type_by_domain={},
846
937
  @verifier_domain="example.com",
@@ -873,10 +964,7 @@ Truemail.validate('email@example.com')
873
964
  #<struct Truemail::Validate::Smtp::Response
874
965
  port_opened=true,
875
966
  connection=true,
876
- helo=
877
- #<Net::SMTP::Response:0x0000000002d5aca8
878
- @status="250",
879
- @string="250 127.0.1.1 Hello example.com\n">,
967
+ helo=true,
880
968
  mailfrom=#<Net::SMTP::Response:0x0000000002d5a618 @status="250", @string="250 OK\n">,
881
969
  rcptto=false,
882
970
  errors={:rcptto=>"550 User not found\n"}>>]>,
@@ -890,6 +978,7 @@ Truemail.validate('email@example.com')
890
978
  @response_timeout=2,
891
979
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
892
980
  @not_rfc_mx_lookup_flow=false,
981
+ @smtp_fail_fast=false,
893
982
  @smtp_safe_check=false,
894
983
  @validation_type_by_domain={},
895
984
  @verifier_domain="example.com",
@@ -937,6 +1026,7 @@ Truemail.host_audit
937
1026
  @response_timeout=2,
938
1027
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
939
1028
  @not_rfc_mx_lookup_flow=false,
1029
+ @smtp_fail_fast=false,
940
1030
  @smtp_safe_check=false,
941
1031
  @validation_type_by_domain={},
942
1032
  @verifier_domain="example.com",
@@ -963,6 +1053,7 @@ Truemail.host_audit
963
1053
  @response_timeout=2,
964
1054
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
965
1055
  @not_rfc_mx_lookup_flow=false,
1056
+ @smtp_fail_fast=false,
966
1057
  @smtp_safe_check=false,
967
1058
  @validation_type_by_domain={},
968
1059
  @verifier_domain="example.com",
@@ -1011,6 +1102,7 @@ Truemail::Log::Serializer::AuditorJson.call(Truemail.host_audit)
1011
1102
  "whitelisted_domains": null,
1012
1103
  "blacklisted_domains": null,
1013
1104
  "not_rfc_mx_lookup_flow": false,
1105
+ "smtp_fail_fast": false,
1014
1106
  "smtp_safe_check": false,
1015
1107
  "email_pattern": "default gem value",
1016
1108
  "smtp_error_body_pattern": "default gem value"
@@ -1049,6 +1141,7 @@ Truemail::Log::Serializer::ValidatorJson.call(Truemail.validate('nonexistent_ema
1049
1141
  "whitelisted_domains": null,
1050
1142
  "blacklisted_domains": null,
1051
1143
  "not_rfc_mx_lookup_flow": false,
1144
+ "smtp_fail_fast": false,
1052
1145
  "smtp_safe_check": false,
1053
1146
  "email_pattern": "default gem value",
1054
1147
  "smtp_error_body_pattern": "default gem value"
@@ -1089,6 +1182,7 @@ Truemail.host_audit.as_json
1089
1182
  "whitelisted_domains": null,
1090
1183
  "blacklisted_domains": null,
1091
1184
  "not_rfc_mx_lookup_flow": false,
1185
+ "smtp_fail_fast": false,
1092
1186
  "smtp_safe_check": false,
1093
1187
  "email_pattern": "default gem value",
1094
1188
  "smtp_error_body_pattern": "default gem value"
@@ -1124,6 +1218,7 @@ Truemail.validate('nonexistent_email@bestweb.com.ua').as_json
1124
1218
  "whitelisted_domains": null,
1125
1219
  "blacklisted_domains": null,
1126
1220
  "not_rfc_mx_lookup_flow": false,
1221
+ "smtp_fail_fast": false,
1127
1222
  "smtp_safe_check": false,
1128
1223
  "email_pattern": "default gem value",
1129
1224
  "smtp_error_body_pattern": "default gem value"
@@ -1174,11 +1269,12 @@ All Truemail solutions: https://truemail-rb.org
1174
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 |
1175
1270
  | [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
1176
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 |
1177
1273
  | [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
1178
1274
 
1179
1275
  ## Contributing
1180
1276
 
1181
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubygarage/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tikets](https://github.com/rubygarage/truemail/issues). Be shure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
1277
+ Bug reports and pull requests are welcome on GitHub at https://github.com/truemail-rb/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tikets](https://github.com/truemail-rb/truemail/issues). Be shure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
1182
1278
 
1183
1279
  ## License
1184
1280
 
@@ -1190,8 +1286,8 @@ Everyone interacting in the Truemail project’s codebases, issue trackers, chat
1190
1286
 
1191
1287
  ## Credits
1192
1288
 
1193
- - [The Contributors](https://github.com/rubygarage/truemail/graphs/contributors) for code and awesome suggestions
1194
- - [The Stargazers](https://github.com/rubygarage/truemail/stargazers) for showing their support
1289
+ - [The Contributors](https://github.com/truemail-rb/truemail/graphs/contributors) for code and awesome suggestions
1290
+ - [The Stargazers](https://github.com/truemail-rb/truemail/stargazers) for showing their support
1195
1291
 
1196
1292
  ## Versioning
1197
1293