truemail 1.6.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,95 +1,87 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (1.6.0)
4
+ truemail (1.9.0)
5
5
  simpleidn (~> 0.1.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
11
- axiom-types (0.1.1)
12
- descendants_tracker (~> 0.0.4)
13
- ice_nine (~> 0.11.0)
14
- thread_safe (~> 0.3, >= 0.3.1)
15
- bundler-audit (0.6.1)
10
+ ast (2.4.1)
11
+ bundler-audit (0.7.0.1)
16
12
  bundler (>= 1.2.0, < 3)
17
- thor (~> 0.18)
18
- byebug (11.1.1)
19
- childprocess (3.0.0)
20
- codeclimate-engine-rb (0.4.1)
21
- virtus (~> 1.0)
22
- coderay (1.1.2)
23
- coercible (1.0.0)
24
- descendants_tracker (~> 0.0.1)
13
+ thor (>= 0.18, < 2)
14
+ byebug (11.1.3)
15
+ childprocess (4.0.0)
16
+ coderay (1.1.3)
25
17
  colorize (0.8.1)
26
- descendants_tracker (0.0.4)
27
- thread_safe (~> 0.3, >= 0.3.1)
28
- diff-lcs (1.3)
18
+ diff-lcs (1.4.4)
29
19
  docile (1.3.2)
30
- equalizer (0.0.11)
31
- fasterer (0.8.1)
20
+ fasterer (0.8.3)
32
21
  colorize (~> 0.7)
33
22
  ruby_parser (>= 3.14.1)
34
- ffaker (2.13.0)
35
- ice_nine (0.11.2)
36
- iniparse (1.4.4)
37
- jaro_winkler (1.5.4)
38
- json (2.3.0)
23
+ ffaker (2.17.0)
24
+ iniparse (1.5.0)
25
+ json (2.3.1)
39
26
  json_matchers (0.11.1)
40
27
  json_schema
41
- json_schema (0.20.8)
28
+ json_schema (0.20.9)
42
29
  kwalify (0.7.2)
43
- method_source (0.9.2)
44
- overcommit (0.52.1)
45
- childprocess (>= 0.6.3, < 4)
30
+ method_source (1.0.0)
31
+ overcommit (0.55.0)
32
+ childprocess (>= 0.6.3, < 5)
46
33
  iniparse (~> 1.4)
47
- parallel (1.19.1)
48
- parser (2.7.0.2)
49
- ast (~> 2.4.0)
50
- pry (0.12.2)
51
- coderay (~> 1.1.0)
52
- method_source (~> 0.9.0)
53
- pry-byebug (3.8.0)
34
+ parallel (1.19.2)
35
+ parser (2.7.1.4)
36
+ ast (~> 2.4.1)
37
+ pry (0.13.1)
38
+ coderay (~> 1.1)
39
+ method_source (~> 1.0)
40
+ pry-byebug (3.9.0)
54
41
  byebug (~> 11.0)
55
- pry (~> 0.10)
42
+ pry (~> 0.13.0)
56
43
  psych (3.1.0)
57
44
  rainbow (3.0.0)
58
45
  rake (13.0.1)
59
- reek (5.6.0)
60
- codeclimate-engine-rb (~> 0.4.0)
46
+ reek (6.0.1)
61
47
  kwalify (~> 0.7.0)
62
48
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
63
49
  psych (~> 3.1.0)
64
50
  rainbow (>= 2.0, < 4.0)
51
+ regexp_parser (1.7.1)
52
+ rexml (3.2.4)
65
53
  rspec (3.9.0)
66
54
  rspec-core (~> 3.9.0)
67
55
  rspec-expectations (~> 3.9.0)
68
56
  rspec-mocks (~> 3.9.0)
69
- rspec-core (3.9.1)
70
- rspec-support (~> 3.9.1)
71
- rspec-expectations (3.9.0)
57
+ rspec-core (3.9.2)
58
+ rspec-support (~> 3.9.3)
59
+ rspec-expectations (3.9.2)
72
60
  diff-lcs (>= 1.2.0, < 2.0)
73
61
  rspec-support (~> 3.9.0)
74
62
  rspec-mocks (3.9.1)
75
63
  diff-lcs (>= 1.2.0, < 2.0)
76
64
  rspec-support (~> 3.9.0)
77
- rspec-support (3.9.2)
78
- rubocop (0.79.0)
79
- jaro_winkler (~> 1.5.1)
65
+ rspec-support (3.9.3)
66
+ rubocop (0.89.1)
80
67
  parallel (~> 1.10)
81
- parser (>= 2.7.0.1)
68
+ parser (>= 2.7.1.1)
82
69
  rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.7)
71
+ rexml
72
+ rubocop-ast (>= 0.3.0, < 1.0)
83
73
  ruby-progressbar (~> 1.7)
84
- unicode-display_width (>= 1.4.0, < 1.7)
85
- rubocop-performance (1.5.2)
86
- rubocop (>= 0.71.0)
87
- rubocop-rspec (1.37.1)
88
- rubocop (>= 0.68.1)
74
+ unicode-display_width (>= 1.4.0, < 2.0)
75
+ rubocop-ast (0.3.0)
76
+ parser (>= 2.7.1.4)
77
+ rubocop-performance (1.7.1)
78
+ rubocop (>= 0.82.0)
79
+ rubocop-rspec (1.43.2)
80
+ rubocop (~> 0.87)
89
81
  ruby-progressbar (1.10.1)
90
- ruby_parser (3.14.1)
82
+ ruby_parser (3.14.2)
91
83
  sexp_processor (~> 4.9)
92
- sexp_processor (4.13.0)
84
+ sexp_processor (4.15.0)
93
85
  simplecov (0.17.1)
94
86
  docile (~> 1.1)
95
87
  json (>= 1.8, < 3)
@@ -97,41 +89,35 @@ GEM
97
89
  simplecov-html (0.10.2)
98
90
  simpleidn (0.1.1)
99
91
  unf (~> 0.1.4)
100
- thor (0.20.3)
101
- thread_safe (0.3.6)
102
- truemail-rspec (0.1.1)
103
- rspec (~> 3.0)
92
+ thor (1.0.1)
93
+ truemail-rspec (0.2.0)
94
+ rspec (~> 3.9)
104
95
  truemail (~> 1.4, >= 1.4.1)
105
96
  unf (0.1.4)
106
97
  unf_ext
107
- unf_ext (0.0.7.6)
108
- unicode-display_width (1.6.1)
109
- virtus (1.0.5)
110
- axiom-types (~> 0.1)
111
- coercible (~> 1.0)
112
- descendants_tracker (~> 0.0, >= 0.0.3)
113
- equalizer (~> 0.0, >= 0.0.9)
98
+ unf_ext (0.0.7.7)
99
+ unicode-display_width (1.7.0)
114
100
 
115
101
  PLATFORMS
116
102
  ruby
117
103
 
118
104
  DEPENDENCIES
119
105
  bundler (~> 1.16)
120
- bundler-audit (~> 0.6.1)
121
- fasterer (~> 0.8.1)
122
- ffaker (~> 2.13)
106
+ bundler-audit (~> 0.7.0.1)
107
+ fasterer (~> 0.8.3)
108
+ ffaker (~> 2.17)
123
109
  json_matchers (~> 0.11.1)
124
- overcommit (~> 0.52.1)
125
- pry-byebug (~> 3.8)
110
+ overcommit (~> 0.55.0)
111
+ pry-byebug (~> 3.9)
126
112
  rake (~> 13.0, >= 13.0.1)
127
- reek (~> 5.6)
113
+ reek (~> 6.0, >= 6.0.1)
128
114
  rspec (~> 3.9)
129
- rubocop (~> 0.79.0)
130
- rubocop-performance (~> 1.5, >= 1.5.2)
131
- rubocop-rspec (~> 1.37, >= 1.37.1)
115
+ rubocop (~> 0.89.1)
116
+ rubocop-performance (~> 1.7, >= 1.7.1)
117
+ rubocop-rspec (~> 1.43, >= 1.43.2)
132
118
  simplecov (~> 0.17.1)
133
119
  truemail!
134
- truemail-rspec (~> 0.1.1)
120
+ truemail-rspec (~> 0.2.0)
135
121
 
136
122
  BUNDLED WITH
137
123
  1.16.6
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # <img src='https://repository-images.githubusercontent.com/173723932/6dffee00-e88e-11e9-94b6-c97aacc0df00' height='250' alt='Truemail - configurable framework agnostic plain Ruby email validator' />
1
+ ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
2
2
 
3
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)
4
4
 
@@ -8,6 +8,7 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
8
8
 
9
9
  - [Synopsis](#synopsis)
10
10
  - [Features](#features)
11
+ - [Requirements](#requirements)
11
12
  - [Installation](#installation)
12
13
  - [Usage](#usage)
13
14
  - [Configuration features](#configuration-features)
@@ -26,14 +27,21 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
26
27
  - [With default regex pattern](#with-default-regex-pattern)
27
28
  - [With custom regex pattern](#with-custom-regex-pattern)
28
29
  - [DNS (MX) validation](#mx-validation)
30
+ - [RFC MX lookup flow](#rfc-mx-lookup-flow)
31
+ - [Not RFC MX lookup flow](#not-rfc-mx-lookup-flow)
29
32
  - [SMTP validation](#smtp-validation)
30
33
  - [SMTP safe check disabled](#smtp-safe-check-disabled)
31
34
  - [SMTP safe check enabled](#smtp-safe-check-enabled)
32
- - [Event logger](#event-logger)
33
- - [Available tracking events](#available-tracking-events)
34
- - [JSON serializer](#json-serializer)
35
35
  - [Host audit features](#host-audit-features)
36
+ - [IP audit](#ip-audit)
37
+ - [DNS audit](#dns-audit)
36
38
  - [PTR audit](#ptr-audit)
39
+ - [Example of using](#example-of-using)
40
+ - [Event logger](#event-logger)
41
+ - [Available tracking events](#available-tracking-events)
42
+ - [JSON serializers](#json-serializers)
43
+ - [Auditor JSON serializer](#auditor-json-serializer)
44
+ - [Validator JSON serializer](#validator-json-serializer)
37
45
  - [Truemail helpers](#truemail-helpers)
38
46
  - [.valid?](#valid)
39
47
  - [#as_json](#as_json)
@@ -45,11 +53,11 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
45
53
  - [Credits](#credits)
46
54
  - [Versioning](#versioning)
47
55
  - [Changelog](CHANGELOG.md)
48
- - [Wiki](https://github.com/rubygarage/truemail/wiki)
56
+ - [Developers Documentation](https://truemail-rb.org/truemail-gem/)
49
57
 
50
58
  ## Synopsis
51
59
 
52
- Email validation is a tricky thing. There are a number of different ways to validate an email address and all mechanisms must conform with the best practices and provide proper validation. You can get more information about email validation techniques in our [blog](https://rubygarage.org/blog/how-to-validate-emails). The Truemail gem helps you validate emails via regex pattern, presence of DNS records, and real existence of email account on a current email server.
60
+ Email validation is a tricky thing. There are a number of different ways to validate an email address and all mechanisms must conform with the best practices and provide proper validation. The Truemail gem helps you validate emails via regex pattern, presence of DNS records, and real existence of email account on a current email server.
53
61
 
54
62
  **Syntax Checking**: Checks the email addresses via regex pattern.
55
63
 
@@ -67,7 +75,12 @@ Also Truemail gem allows performing an audit of the host in which runs.
67
75
  - Whitelist/blacklist validation layers
68
76
  - Simple SMTP debugger
69
77
  - Event logger
70
- - JSON serializer
78
+ - Host auditor tools (helps to detect common host problems interfering to proper email verification)
79
+ - JSON serializers
80
+
81
+ ## Requirements
82
+
83
+ Ruby MRI 2.5.0+
71
84
 
72
85
  ## Installation
73
86
 
@@ -79,11 +92,15 @@ gem 'truemail'
79
92
 
80
93
  And then execute:
81
94
 
82
- $ bundle
95
+ ```bash
96
+ bundle
97
+ ```
83
98
 
84
99
  Or install it yourself as:
85
100
 
86
- $ gem install truemail
101
+ ```bash
102
+ gem install truemail
103
+ ```
87
104
 
88
105
  ## Usage
89
106
 
@@ -168,6 +185,11 @@ Truemail.configure do |config|
168
185
  # It is equal to empty array by default.
169
186
  config.blacklisted_domains = ['somedomain1.com', 'somedomain2.com']
170
187
 
188
+ # Optional parameter. This option will provide to use not RFC MX lookup flow.
189
+ # It means that MX and Null MX records will be cheked on the DNS validation layer only.
190
+ # By default this option is disabled.
191
+ config.not_rfc_mx_lookup_flow = true
192
+
171
193
  # Optional parameter. This option will be parse bodies of SMTP errors. It will be helpful
172
194
  # if SMTP server does not return an exact answer that the email does not exist
173
195
  # By default this option is disabled, available for SMTP validation only.
@@ -198,7 +220,8 @@ Truemail.configuration
198
220
  @whitelist_validation=true,
199
221
  @blacklisted_domains=[],
200
222
  @verifier_domain="somedomain.com",
201
- @verifier_email="verifier@example.com"
223
+ @verifier_email="verifier@example.com",
224
+ @not_rfc_mx_lookup_flow=true,
202
225
  @smtp_safe_check=true,
203
226
  @logger=#<Truemail::Logger:0x0000557f837450b0
204
227
  @event=:all, @file="/home/app/log/truemail.log", @stdout=true>>
@@ -227,6 +250,7 @@ Truemail.configuration
227
250
  @blacklisted_domains=[],
228
251
  @verifier_domain="somedomain.com",
229
252
  @verifier_email="verifier@example.com",
253
+ @not_rfc_mx_lookup_flow=true,
230
254
  @smtp_safe_check=true,
231
255
  @logger=#<Truemail::Logger:0x0000557f837450b0
232
256
  @event=:all, @file="/home/app/log/truemail.log", @stdout=true>>
@@ -309,6 +333,7 @@ Truemail.validate('email@white-domain.com')
309
333
  @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)/,
310
334
  @response_timeout=2,
311
335
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
336
+ @not_rfc_mx_lookup_flow=false,
312
337
  @smtp_safe_check=false,
313
338
  @validation_type_by_domain={"somedomain.com"=>:mx},
314
339
  @verifier_domain="example.com",
@@ -355,6 +380,7 @@ Truemail.validate('email@white-domain.com', with: :regex)
355
380
  @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)/,
356
381
  @response_timeout=2,
357
382
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
383
+ @not_rfc_mx_lookup_flow=false,
358
384
  @smtp_safe_check=false,
359
385
  @validation_type_by_domain={},
360
386
  @verifier_domain="example.com",
@@ -386,6 +412,7 @@ Truemail.validate('email@domain.com', with: :regex)
386
412
  @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)/,
387
413
  @response_timeout=2,
388
414
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
415
+ @not_rfc_mx_lookup_flow=false,
389
416
  @smtp_safe_check=false,
390
417
  @validation_type_by_domain={},
391
418
  @verifier_domain="example.com",
@@ -419,6 +446,7 @@ Truemail.validate('email@black-domain.com')
419
446
  @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)/,
420
447
  @response_timeout=2,
421
448
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
449
+ @not_rfc_mx_lookup_flow=false,
422
450
  @smtp_safe_check=false,
423
451
  @validation_type_by_domain={},
424
452
  @verifier_domain="example.com",
@@ -452,6 +480,7 @@ Truemail.validate('email@somedomain.com')
452
480
  @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)/,
453
481
  @response_timeout=2,
454
482
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
483
+ @not_rfc_mx_lookup_flow=false,
455
484
  @smtp_safe_check=false,
456
485
  @validation_type_by_domain={},
457
486
  @verifier_domain="example.com",
@@ -501,6 +530,7 @@ Truemail.validate('email@example.com', with: :regex)
501
530
  @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)/,
502
531
  @response_timeout=2,
503
532
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
533
+ @not_rfc_mx_lookup_flow=false,
504
534
  @smtp_safe_check=false,
505
535
  @validation_type_by_domain={},
506
536
  @verifier_domain="example.com",
@@ -542,6 +572,7 @@ Truemail.validate('email@example.com', with: :regex)
542
572
  @email_pattern=/regex_pattern/,
543
573
  @response_timeout=2,
544
574
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
575
+ @not_rfc_mx_lookup_flow=false,
545
576
  @smtp_safe_check=false,
546
577
  @validation_type_by_domain={},
547
578
  @verifier_domain="example.com",
@@ -559,7 +590,11 @@ In fact it's DNS validation because it checks not MX records only. DNS validatio
559
590
  [Whitelist/Blacklist] -> [Regex validation] -> [MX validation]
560
591
  ```
561
592
 
562
- Please note, Truemail MX validator not performs strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
593
+ 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.
594
+
595
+ ##### RFC MX lookup flow
596
+
597
+ [Truemail MX lookup](https://slides.com/vladislavtrotsenko/truemail#/0/9) based on RFC 5321. It consists of 3 substeps: MX, CNAME and A record resolvers. The point of each resolver is attempt to extract the mail servers from email domain. If at least one server exists that validation is successful. Iteration is processing until resolver returns true.
563
598
 
564
599
  Example of usage:
565
600
 
@@ -590,6 +625,51 @@ Truemail.validate('email@example.com', with: :mx)
590
625
  @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)/,
591
626
  @response_timeout=2,
592
627
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
628
+ @not_rfc_mx_lookup_flow=false,
629
+ @smtp_safe_check=false,
630
+ @validation_type_by_domain={},
631
+ @verifier_domain="example.com",
632
+ @verifier_email="verifier@example.com",
633
+ @whitelist_validation=false,
634
+ @whitelisted_domains=[]>,
635
+ @validation_type=:mx>
636
+ ```
637
+
638
+ ##### Not RFC MX lookup flow
639
+
640
+ Also Truemail has possibility to use not RFC MX lookup flow. It means that will be used only one MX resolver on the DNS validation layer. By default this option is disabled.
641
+
642
+ Example of usage:
643
+
644
+ ```ruby
645
+ require 'truemail'
646
+
647
+ Truemail.configure do |config|
648
+ config.verifier_email = 'verifier@example.com'
649
+ config.not_rfc_mx_lookup_flow = true
650
+ end
651
+
652
+ Truemail.validate('email@example.com', with: :mx)
653
+
654
+ => #<Truemail::Validator:0x000055590c9c1c50
655
+ @result=
656
+ #<struct Truemail::Validator::Result
657
+ success=true,
658
+ email="email@example.com",
659
+ domain="example.com",
660
+ mail_servers=["127.0.1.1", "127.0.1.2"],
661
+ errors={},
662
+ smtp_debug=nil>,
663
+ configuration=
664
+ #<Truemail::Configuration:0x0000559b6e44af70
665
+ @blacklisted_domains=[],
666
+ @connection_attempts=2,
667
+ @connection_timeout=2,
668
+ @default_validation_type=:smtp,
669
+ @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)/,
670
+ @response_timeout=2,
671
+ @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
672
+ @not_rfc_mx_lookup_flow=true,
593
673
  @smtp_safe_check=false,
594
674
  @validation_type_by_domain={},
595
675
  @verifier_domain="example.com",
@@ -611,7 +691,7 @@ If total count of MX servers is equal to one, ```Truemail::Smtp``` validator wil
611
691
 
612
692
  By default, you don't need pass with-parameter to use it. Example of usage is specified below:
613
693
 
614
- ###### SMTP safe check disabled
694
+ ##### SMTP safe check disabled
615
695
 
616
696
  With ```smtp_safe_check = false```
617
697
 
@@ -643,6 +723,7 @@ Truemail.validate('email@example.com')
643
723
  @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)/,
644
724
  @response_timeout=2,
645
725
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
726
+ @not_rfc_mx_lookup_flow=false,
646
727
  @smtp_safe_check=false,
647
728
  @validation_type_by_domain={},
648
729
  @verifier_domain="example.com",
@@ -694,6 +775,7 @@ Truemail.validate('email@example.com')
694
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)/,
695
776
  @response_timeout=2,
696
777
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
778
+ @not_rfc_mx_lookup_flow=false,
697
779
  @smtp_safe_check=false,
698
780
  @validation_type_by_domain={},
699
781
  @verifier_domain="example.com",
@@ -703,8 +785,7 @@ Truemail.validate('email@example.com')
703
785
  @validation_type=:smtp>
704
786
  ```
705
787
 
706
-
707
- ###### SMTP safe check enabled
788
+ ##### SMTP safe check enabled
708
789
 
709
790
  With ```smtp_safe_check = true```
710
791
 
@@ -758,6 +839,7 @@ Truemail.validate('email@example.com')
758
839
  @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)/,
759
840
  @response_timeout=2,
760
841
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
842
+ @not_rfc_mx_lookup_flow=false,
761
843
  @smtp_safe_check=false,
762
844
  @validation_type_by_domain={},
763
845
  @verifier_domain="example.com",
@@ -806,6 +888,7 @@ Truemail.validate('email@example.com')
806
888
  @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)/,
807
889
  @response_timeout=2,
808
890
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
891
+ @not_rfc_mx_lookup_flow=false,
809
892
  @smtp_safe_check=false,
810
893
  @validation_type_by_domain={},
811
894
  @verifier_domain="example.com",
@@ -815,76 +898,33 @@ Truemail.validate('email@example.com')
815
898
  @validation_type=:smtp>
816
899
  ```
817
900
 
818
- ### Event logger
819
-
820
- Truemail gem allows to output tracking events to stdout/file or both of these. Please note, at least one of the outputs must exist. Tracking event by default is `:error`
821
-
822
- ```ruby
823
- Truemail.configure do |config|
824
- config.logger = { tracking_event: :all, stdout: true, log_absolute_path: '/home/app/log/truemail.log' }
825
- end
826
- ```
827
-
828
- #### Available tracking events
829
-
830
- - `:all`, all detected events including success validation cases
831
- - `:unrecognized_error`, unrecognized errors only (when `smtp_safe_check = true` and SMTP server does not return an exact answer that the email does not exist)
832
- - `:recognized_error`, recognized errors only
833
- - `:error`, recognized and unrecognized errors only
834
-
835
- ### JSON serializer
901
+ ### Host audit features
836
902
 
837
- Truemail has built in JSON serializer for `Truemail::Validator` instance, so you can represent your email validation result as json.
903
+ Truemail gem allows performing an audit of the host in which runs. It will help to detect common host problems interfering to proper email verification.
838
904
 
839
- ```ruby
840
- Truemail::Log::Serializer::Json.call(Truemail.validate('nonexistent_email@bestweb.com.ua'))
905
+ #### IP audit
841
906
 
842
- =>
843
- # Serialized Truemail::Validator instance
844
- {
845
- "date": "2019-10-28 10:15:51 +0200",
846
- "email": "nonexistent_email@bestweb.com.ua",
847
- "validation_type": "smtp",
848
- "success": false,
849
- "errors": {
850
- "smtp": "smtp error"
851
- },
852
- "smtp_debug": [
853
- {
854
- "mail_host": "213.180.193.89",
855
- "port_opened": true,
856
- "connection": true,
857
- "errors": {
858
- "rcptto": "550 5.7.1 No such user!\n"
859
- }
860
- }
861
- ],
862
- "configuration": {
863
- "validation_type_by_domain": null,
864
- "whitelist_validation": false,
865
- "whitelisted_domains": null,
866
- "blacklisted_domains": null,
867
- "smtp_safe_check": false,
868
- "email_pattern": "default gem value",
869
- "smtp_error_body_pattern": "default gem value"
870
- }
871
- }
872
- ```
907
+ Checks is current Truemail host has proper internet connection and detects current host ip address.
873
908
 
874
- ### Host audit features
909
+ #### DNS audit
875
910
 
876
- Truemail gem allows performing an audit of the host in which runs. Only PTR record audit performs for today.
911
+ Checks is verifier domain refer to current Truemail host IP address.
877
912
 
878
913
  #### PTR audit
879
914
 
880
915
  So what is a PTR record? A PTR record, or pointer record, enables someone to perform a reverse DNS lookup. This allows them to determine your domain name based on your IP address. Because generic domain names without a PTR are often associated with spammers, incoming mail servers identify email from hosts without PTR records as spam and you can't verify yours emails qualitatively.
881
916
 
917
+ Checks is PTR record exists for your Truemail host ip address exists and refers to current verifier domain.
918
+
919
+ #### Example of using
920
+
882
921
  ```ruby
883
922
  Truemail.host_audit
884
923
  # Everything is good
885
924
  => #<Truemail::Auditor:0x00005580df358828
886
925
  @result=
887
926
  #<struct Truemail::Auditor::Result
927
+ current_host_ip="127.0.0.1",
888
928
  warnings={}>,
889
929
  configuration=
890
930
  #<Truemail::Configuration:0x00005615e86327a8
@@ -895,6 +935,7 @@ Truemail.host_audit
895
935
  @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)/,
896
936
  @response_timeout=2,
897
937
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
938
+ @not_rfc_mx_lookup_flow=false,
898
939
  @smtp_safe_check=false,
899
940
  @validation_type_by_domain={},
900
941
  @verifier_domain="example.com",
@@ -902,12 +943,15 @@ Truemail.host_audit
902
943
  @whitelist_validation=false,
903
944
  @whitelisted_domains=[]>
904
945
 
905
- # Has PTR warning
946
+ # Has audit warnings
906
947
  => #<Truemail::Auditor:0x00005580df358828
907
948
  @result=
908
949
  #<struct Truemail::Auditor::Result
909
- warnings=
910
- {:ptr=>"ptr record does not reference to current verifier domain"}>,
950
+ current_host_ip="127.0.0.1",
951
+ warnings={
952
+ :dns=>"A-record of verifier domain not refers to current host ip address",
953
+ :ptr=>"PTR-record does not reference to current verifier domain"
954
+ },
911
955
  configuration=
912
956
  #<Truemail::Configuration:0x00005615e86327a8
913
957
  @blacklisted_domains=[],
@@ -917,6 +961,7 @@ Truemail.host_audit
917
961
  @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)/,
918
962
  @response_timeout=2,
919
963
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
964
+ @not_rfc_mx_lookup_flow=false,
920
965
  @smtp_safe_check=false,
921
966
  @validation_type_by_domain={},
922
967
  @verifier_domain="example.com",
@@ -925,6 +970,91 @@ Truemail.host_audit
925
970
  @whitelisted_domains=[]>
926
971
  ```
927
972
 
973
+ ### Event logger
974
+
975
+ Truemail gem allows to output tracking events to stdout/file or both of these. Please note, at least one of the outputs must exist. Tracking event by default is `:error`
976
+
977
+ ```ruby
978
+ Truemail.configure do |config|
979
+ config.logger = { tracking_event: :all, stdout: true, log_absolute_path: '/home/app/log/truemail.log' }
980
+ end
981
+ ```
982
+
983
+ #### Available tracking events
984
+
985
+ - `:all`, all detected events including success validation cases
986
+ - `:unrecognized_error`, unrecognized errors only (when `smtp_safe_check = true` and SMTP server does not return an exact answer that the email does not exist)
987
+ - `:recognized_error`, recognized errors only
988
+ - `:error`, recognized and unrecognized errors only
989
+
990
+ ### JSON serializers
991
+
992
+ Truemail has built in JSON serializers for `Truemail::Auditor` and `Truemail::Validator` instances, so you can represent your host audition or email validation result as json. Also you can use [#as_json](#as_json) helper for shortcuting.
993
+
994
+ #### Auditor JSON serializer
995
+
996
+ ```ruby
997
+ Truemail::Log::Serializer::AuditorJson.call(Truemail.host_audit)
998
+
999
+ =>
1000
+ # Serialized Truemail::Auditor instance
1001
+ {
1002
+ "date": "2020-08-31 22:33:43 +0300",
1003
+ "current_host_ip": "127.0.0.1",
1004
+ "warnings": {
1005
+ "dns": "A-record of verifier domain not refers to current host ip address", "ptr": "PTR-record does not reference to current verifier domain"
1006
+ },
1007
+ "configuration": {
1008
+ "validation_type_by_domain": null,
1009
+ "whitelist_validation": false,
1010
+ "whitelisted_domains": null,
1011
+ "blacklisted_domains": null,
1012
+ "not_rfc_mx_lookup_flow": false,
1013
+ "smtp_safe_check": false,
1014
+ "email_pattern": "default gem value",
1015
+ "smtp_error_body_pattern": "default gem value"
1016
+ }
1017
+ }
1018
+ ```
1019
+
1020
+ #### Validator JSON serializer
1021
+
1022
+ ```ruby
1023
+ Truemail::Log::Serializer::ValidatorJson.call(Truemail.validate('nonexistent_email@bestweb.com.ua'))
1024
+
1025
+ =>
1026
+ # Serialized Truemail::Validator instance
1027
+ {
1028
+ "date": "2019-10-28 10:15:51 +0200",
1029
+ "email": "nonexistent_email@bestweb.com.ua",
1030
+ "validation_type": "smtp",
1031
+ "success": false,
1032
+ "errors": {
1033
+ "smtp": "smtp error"
1034
+ },
1035
+ "smtp_debug": [
1036
+ {
1037
+ "mail_host": "213.180.193.89",
1038
+ "port_opened": true,
1039
+ "connection": true,
1040
+ "errors": {
1041
+ "rcptto": "550 5.7.1 No such user!\n"
1042
+ }
1043
+ }
1044
+ ],
1045
+ "configuration": {
1046
+ "validation_type_by_domain": null,
1047
+ "whitelist_validation": false,
1048
+ "whitelisted_domains": null,
1049
+ "blacklisted_domains": null,
1050
+ "not_rfc_mx_lookup_flow": false,
1051
+ "smtp_safe_check": false,
1052
+ "email_pattern": "default gem value",
1053
+ "smtp_error_body_pattern": "default gem value"
1054
+ }
1055
+ }
1056
+ ```
1057
+
928
1058
  ### Truemail helpers
929
1059
 
930
1060
  #### .valid?
@@ -939,15 +1069,38 @@ Truemail.valid?('email@example.com')
939
1069
 
940
1070
  #### #as_json
941
1071
 
942
- You can use `#as_json` helper for represent `Truemail::Validator` instance as json. Under the hood it uses internal json serializer [`Truemail::Log::Serializer::Json`](#json-serializer):
1072
+ You can use `#as_json` helper for represent `Truemail::Auditor` or `Truemail::Validator` instances as json. Under the hood it uses internal json `Truemail::Log::Serializer::AuditorJson` and `Truemail::Log::Serializer::ValidatorJson` [serializers](#json-serializers):
943
1073
 
944
1074
  ```ruby
1075
+ Truemail.host_audit.as_json
1076
+
1077
+ =>
1078
+ # Serialized Truemail::Auditor instance
1079
+ {
1080
+ "date": "2020-08-31 22:33:43 +0300",
1081
+ "current_host_ip": "127.0.0.1",
1082
+ "warnings": {
1083
+ "dns": "A-record of verifier domain not refers to current host ip address", "ptr": "PTR-record does not reference to current verifier domain"
1084
+ },
1085
+ "configuration": {
1086
+ "validation_type_by_domain": null,
1087
+ "whitelist_validation": false,
1088
+ "whitelisted_domains": null,
1089
+ "blacklisted_domains": null,
1090
+ "not_rfc_mx_lookup_flow": false,
1091
+ "smtp_safe_check": false,
1092
+ "email_pattern": "default gem value",
1093
+ "smtp_error_body_pattern": "default gem value"
1094
+ }
1095
+ }
1096
+
1097
+
945
1098
  Truemail.validate('nonexistent_email@bestweb.com.ua').as_json
946
1099
 
947
1100
  =>
948
1101
  # Serialized Truemail::Validator instance
949
1102
  {
950
- "date": "2020-02-01 10:00:00 +0200",
1103
+ "date": "2020-05-10 10:00:00 +0200",
951
1104
  "email": "nonexistent_email@bestweb.com.ua",
952
1105
  "validation_type": "smtp",
953
1106
  "success": false,
@@ -969,6 +1122,7 @@ Truemail.validate('nonexistent_email@bestweb.com.ua').as_json
969
1122
  "whitelist_validation": false,
970
1123
  "whitelisted_domains": null,
971
1124
  "blacklisted_domains": null,
1125
+ "not_rfc_mx_lookup_flow": false,
972
1126
  "smtp_safe_check": false,
973
1127
  "email_pattern": "default gem value",
974
1128
  "smtp_error_body_pattern": "default gem value"
@@ -1008,13 +1162,18 @@ end
1008
1162
  ```
1009
1163
 
1010
1164
  ---
1011
- ## Truemail family
1012
1165
 
1013
- All Truemail extensions: https://github.com/truemail-rb
1166
+ ## Truemail family
1014
1167
 
1015
- ### truemail-rspec
1168
+ All Truemail solutions: https://truemail-rb.org
1016
1169
 
1017
- gem `truemail-rspec` - Truemail configuration and validator RSpec helpers, https://github.com/truemail-rb/truemail-rspec
1170
+ | Name | Type | Description |
1171
+ | --- | --- | --- |
1172
+ | [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail gem |
1173
+ | [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 |
1174
+ | [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
1175
+ | [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
1176
+ | [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
1018
1177
 
1019
1178
  ## Contributing
1020
1179
 
@@ -1036,8 +1195,3 @@ Everyone interacting in the Truemail project’s codebases, issue trackers, chat
1036
1195
  ## Versioning
1037
1196
 
1038
1197
  Truemail uses [Semantic Versioning 2.0.0](https://semver.org)
1039
-
1040
- ---
1041
- <a href="https://rubygarage.org/"><img src="https://rubygarage.s3.amazonaws.com/assets/assets/rg_color_logo_horizontal-919afc51a81d2e40cb6a0b43ee832e3fcd49669d06785156d2d16fd0d799f89e.png" alt="RubyGarage Logo" width="415" height="128"></a>
1042
-
1043
- RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. [Check out our portfolio](https://rubygarage.org/portfolio) for even more exciting works!