truemail 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b6b7c40c08f9c357a333dcd5a8f6d3d8942f077b0136cc9108fac99affda555
4
- data.tar.gz: ba8584ae830034431cd0362c963d94c19d3a18216ad00c8add771323b4f29d0f
3
+ metadata.gz: a8aa2a847dea0166eb42aba5355f16b5957a023e6a36ecc891cec30e0a559cc2
4
+ data.tar.gz: 9b2524bb8b8ac19cf6ccf6f6ccf5b2e9bb894f45a35d772c403c3b8665e186b9
5
5
  SHA512:
6
- metadata.gz: 8a9a3704c7768e962351d31f8801f80bd5de4313848e8ddd29564c5da45dde564d6ce0f872d52d2153b09f630e09f9118f44d91a6a1d6952685d0c3eaac58724
7
- data.tar.gz: 805e4c75b4396e40211a8b52f8c91baad90f0d9a94f9d58ae25b2af24b5dff5ddbf7fda4c2280fea0c14e3f4b47b284f65a59a04b0487d67fb69b83cb44441cc
6
+ metadata.gz: 8e22861746116cdb8afae90074bd072e141b561fe911c63f9bf9dbeffe506d2475f486bc136b128403ed1f1aa612c14af3cfeef40d8c46500c5583767d8322ab
7
+ data.tar.gz: 252d1330a8bf6a28b1ce7c4c3b4f5b434e745bb8d8cad43815ace9f2a18ac387d7c4e710f42194278ed09134620ddf5cf8f790ee132f457f1053c5a2463cd8bc
@@ -7,7 +7,7 @@ checks:
7
7
  plugins:
8
8
  rubocop:
9
9
  enabled: true
10
- channel: rubocop-0-76
10
+ channel: rubocop-0-78
11
11
 
12
12
  reek:
13
13
  enabled: true
@@ -7,9 +7,6 @@ AllCops:
7
7
  DisplayStyleGuide: true
8
8
  TargetRubyVersion: 2.5
9
9
 
10
- Metrics/LineLength:
11
- Max: 140
12
-
13
10
  Metrics/ClassLength:
14
11
  Max: 150
15
12
 
@@ -43,6 +40,9 @@ Style/EmptyCaseCondition:
43
40
  Style/RescueStandardError:
44
41
  Enabled: false
45
42
 
43
+ Layout/LineLength:
44
+ Max: 140
45
+
46
46
  Layout/ClassStructure:
47
47
  Enabled: true
48
48
  Categories:
@@ -68,6 +68,9 @@ Layout/ClassStructure:
68
68
  Layout/EmptyLineAfterGuardClause:
69
69
  Enabled: false
70
70
 
71
+ Lint/NonDeterministicRequireOrder:
72
+ Enabled: false
73
+
71
74
  RSpec/ExampleLength:
72
75
  Enabled: false
73
76
 
@@ -1,18 +1,32 @@
1
1
  # Changelog
2
2
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3
3
 
4
+ ## [1.5.0] - 2019-12-29
5
+ ### Added
6
+ - Supporting of internationalized emails ([EAI](https://en.wikipedia.org/wiki/International_email)). Now you can validate emails, like: `dörte@sörensen.de`, `квіточка@пошта.укр`, `alegría@mañana.es`
7
+
8
+ ### Changed
9
+ - `Truemail::RegexConstant::REGEX_DOMAIN`
10
+ - `Truemail::RegexConstant::REGEX_EMAIL_PATTERN`
11
+ - `Truemail::Validator::Result`
12
+ - `Truemail::Validate::Mx#run`
13
+ - `Truemail::Validate::Smtp#establish_smtp_connection`
14
+ - gem runtime dependencies
15
+ - gem development dependencies
16
+ - gem documentation
17
+ - linters configs
18
+
4
19
  ## [1.4.2] - 2019-11-27
5
20
  ### Changed
6
21
  - `Truemail::Configuration`
7
22
  - gem development dependencies
8
23
  - linters configs
9
24
 
10
-
11
25
  ## [1.4.1] - 2019-11-20
12
26
  ### Changed
13
27
  - gem development dependencies
14
- - linters configs
15
28
  - gem documentation
29
+ - linters configs
16
30
 
17
31
  ### Removed
18
32
  - truemail rspec helpers (moved to independent gem [`truemail-rspec`](https://github.com/truemail-rb/truemail-rspec))
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (1.4.2)
4
+ truemail (1.5.0)
5
+ simpleidn (~> 0.1.1)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
@@ -34,13 +35,13 @@ GEM
34
35
  ice_nine (0.11.2)
35
36
  iniparse (1.4.4)
36
37
  jaro_winkler (1.5.4)
37
- json (2.2.0)
38
+ json (2.3.0)
38
39
  json_matchers (0.11.1)
39
40
  json_schema
40
41
  json_schema (0.20.8)
41
42
  kwalify (0.7.2)
42
43
  method_source (0.9.2)
43
- overcommit (0.51.0)
44
+ overcommit (0.52.0)
44
45
  childprocess (>= 0.6.3, < 4)
45
46
  iniparse (~> 1.4)
46
47
  parallel (1.19.1)
@@ -74,16 +75,16 @@ GEM
74
75
  diff-lcs (>= 1.2.0, < 2.0)
75
76
  rspec-support (~> 3.9.0)
76
77
  rspec-support (3.9.0)
77
- rubocop (0.76.0)
78
+ rubocop (0.78.0)
78
79
  jaro_winkler (~> 1.5.1)
79
80
  parallel (~> 1.10)
80
81
  parser (>= 2.6)
81
82
  rainbow (>= 2.2.2, < 4.0)
82
83
  ruby-progressbar (~> 1.7)
83
84
  unicode-display_width (>= 1.4.0, < 1.7)
84
- rubocop-performance (1.5.1)
85
+ rubocop-performance (1.5.2)
85
86
  rubocop (>= 0.71.0)
86
- rubocop-rspec (1.37.0)
87
+ rubocop-rspec (1.37.1)
87
88
  rubocop (>= 0.68.1)
88
89
  ruby-progressbar (1.10.1)
89
90
  ruby_parser (3.14.1)
@@ -94,11 +95,16 @@ GEM
94
95
  json (>= 1.8, < 3)
95
96
  simplecov-html (~> 0.10.0)
96
97
  simplecov-html (0.10.2)
98
+ simpleidn (0.1.1)
99
+ unf (~> 0.1.4)
97
100
  thor (0.20.3)
98
101
  thread_safe (0.3.6)
99
102
  truemail-rspec (0.1.1)
100
103
  rspec (~> 3.0)
101
104
  truemail (~> 1.4, >= 1.4.1)
105
+ unf (0.1.4)
106
+ unf_ext
107
+ unf_ext (0.0.7.6)
102
108
  unicode-display_width (1.6.0)
103
109
  virtus (1.0.5)
104
110
  axiom-types (~> 0.1)
@@ -115,14 +121,14 @@ DEPENDENCIES
115
121
  fasterer (~> 0.8.1)
116
122
  ffaker (~> 2.13)
117
123
  json_matchers (~> 0.11.1)
118
- overcommit (~> 0.51.0)
124
+ overcommit (~> 0.52.0)
119
125
  pry-byebug (~> 3.7)
120
126
  rake (~> 13.0, >= 13.0.1)
121
127
  reek (~> 5.5)
122
128
  rspec (~> 3.9)
123
- rubocop (~> 0.76.0)
124
- rubocop-performance (~> 1.5, >= 1.5.1)
125
- rubocop-rspec (~> 1.37)
129
+ rubocop (~> 0.78.0)
130
+ rubocop-performance (~> 1.5, >= 1.5.2)
131
+ rubocop-rspec (~> 1.37, >= 1.37.1)
126
132
  simplecov (~> 0.17.1)
127
133
  truemail!
128
134
  truemail-rspec (~> 0.1.1)
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # <img src='https://repository-images.githubusercontent.com/173723932/6dffee00-e88e-11e9-94b6-c97aacc0df00' height='250' alt='Truemail - configurable plain Ruby email validator' />
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' />
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) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
4
 
5
- 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. Also Truemail gem allows performing an audit of the host in which runs.
5
+ Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP. Be sure that email address valid and exists.
6
6
 
7
7
  ## Table of Contents
8
8
 
@@ -17,7 +17,7 @@ The Truemail gem helps you validate emails via regex pattern, presence of DNS re
17
17
  - [Reset global configuration](#reset-global-configuration)
18
18
  - [Using custom independent configuration](#using-custom-independent-configuration)
19
19
  - [Validation features](#validation-features)
20
- - [Whitelist/Blacklist check](#whitelist-blacklist-check)
20
+ - [Whitelist/Blacklist check](#whitelistblacklist-check)
21
21
  - [Whitelist case](#whitelist-case)
22
22
  - [Whitelist validation case](#whitelist-validation-case)
23
23
  - [Blacklist case](#blacklist-case)
@@ -41,12 +41,13 @@ The Truemail gem helps you validate emails via regex pattern, presence of DNS re
41
41
  - [Contributing](#contributing)
42
42
  - [License](#license)
43
43
  - [Code of Conduct](#code-of-conduct)
44
+ - [Credits](#credits)
44
45
  - [Versioning](#versioning)
45
46
  - [Changelog](CHANGELOG.md)
46
47
 
47
48
  ## Synopsis
48
49
 
49
- 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).
50
+ 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.
50
51
 
51
52
  **Syntax Checking**: Checks the email addresses via regex pattern.
52
53
 
@@ -54,10 +55,13 @@ Email validation is a tricky thing. There are a number of different ways to vali
54
55
 
55
56
  **Mail Existence Check**: Checks if the email address really exists and can receive email via SMTP connections and email-sending emulation techniques.
56
57
 
58
+ Also Truemail gem allows performing an audit of the host in which runs.
59
+
57
60
  ## Features
58
61
 
59
62
  - Configurable validator, validate only what you need
60
- - Zero runtime dependencies
63
+ - Minimal runtime dependencies
64
+ - Supporting of internationalized emails (EAI)
61
65
  - Whitelist/blacklist validation layers
62
66
  - Simple SMTP debugger
63
67
  - Event logger
@@ -101,7 +105,6 @@ You can use global gem configuration or custom independent configuration. Availa
101
105
  - event logger
102
106
  - JSON serializer
103
107
 
104
-
105
108
  #### Setting global configuration
106
109
 
107
110
  To have an access for ```Truemail.configuration``` and gem configuration features, you must configure it first as in the example below:
@@ -301,7 +304,7 @@ Truemail.validate('email@white-domain.com')
301
304
  @connection_attempts=2,
302
305
  @connection_timeout=2,
303
306
  @default_validation_type=:smtp,
304
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
307
+ @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)/,
305
308
  @response_timeout=2,
306
309
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
307
310
  @smtp_safe_check=false,
@@ -347,7 +350,7 @@ Truemail.validate('email@white-domain.com', with: :regex)
347
350
  @connection_attempts=2,
348
351
  @connection_timeout=2,
349
352
  @default_validation_type=:smtp,
350
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
353
+ @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)/,
351
354
  @response_timeout=2,
352
355
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
353
356
  @smtp_safe_check=false,
@@ -378,7 +381,7 @@ Truemail.validate('email@domain.com', with: :regex)
378
381
  @connection_attempts=2,
379
382
  @connection_timeout=2,
380
383
  @default_validation_type=:smtp,
381
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
384
+ @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)/,
382
385
  @response_timeout=2,
383
386
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
384
387
  @smtp_safe_check=false,
@@ -411,7 +414,7 @@ Truemail.validate('email@black-domain.com')
411
414
  @connection_attempts=2,
412
415
  @connection_timeout=2,
413
416
  @default_validation_type=:smtp,
414
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
417
+ @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)/,
415
418
  @response_timeout=2,
416
419
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
417
420
  @smtp_safe_check=false,
@@ -444,7 +447,7 @@ Truemail.validate('email@somedomain.com')
444
447
  @connection_attempts=2,
445
448
  @connection_timeout=2,
446
449
  @default_validation_type=:smtp,
447
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
450
+ @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)/,
448
451
  @response_timeout=2,
449
452
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
450
453
  @smtp_safe_check=false,
@@ -493,7 +496,7 @@ Truemail.validate('email@example.com', with: :regex)
493
496
  @connection_attempts=2,
494
497
  @connection_timeout=2,
495
498
  @default_validation_type=:smtp,
496
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
499
+ @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)/,
497
500
  @response_timeout=2,
498
501
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
499
502
  @smtp_safe_check=false,
@@ -582,7 +585,7 @@ Truemail.validate('email@example.com', with: :mx)
582
585
  @connection_attempts=2,
583
586
  @connection_timeout=2,
584
587
  @default_validation_type=:smtp,
585
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
588
+ @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)/,
586
589
  @response_timeout=2,
587
590
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
588
591
  @smtp_safe_check=false,
@@ -635,7 +638,7 @@ Truemail.validate('email@example.com')
635
638
  @connection_attempts=2,
636
639
  @connection_timeout=2,
637
640
  @default_validation_type=:smtp,
638
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
641
+ @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)/,
639
642
  @response_timeout=2,
640
643
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
641
644
  @smtp_safe_check=false,
@@ -686,7 +689,7 @@ Truemail.validate('email@example.com')
686
689
  @connection_attempts=2,
687
690
  @connection_timeout=2,
688
691
  @default_validation_type=:smtp,
689
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
692
+ @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)/,
690
693
  @response_timeout=2,
691
694
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
692
695
  @smtp_safe_check=false,
@@ -750,7 +753,7 @@ Truemail.validate('email@example.com')
750
753
  @connection_attempts=2,
751
754
  @connection_timeout=2,
752
755
  @default_validation_type=:smtp,
753
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
756
+ @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)/,
754
757
  @response_timeout=2,
755
758
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
756
759
  @smtp_safe_check=false,
@@ -798,7 +801,7 @@ Truemail.validate('email@example.com')
798
801
  @connection_attempts=2,
799
802
  @connection_timeout=2,
800
803
  @default_validation_type=:smtp,
801
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
804
+ @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)/,
802
805
  @response_timeout=2,
803
806
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
804
807
  @smtp_safe_check=false,
@@ -887,7 +890,7 @@ Truemail.host_audit
887
890
  @connection_attempts=2,
888
891
  @connection_timeout=2,
889
892
  @default_validation_type=:smtp,
890
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
893
+ @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)/,
891
894
  @response_timeout=2,
892
895
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
893
896
  @smtp_safe_check=false,
@@ -909,7 +912,7 @@ Truemail.host_audit
909
912
  @connection_attempts=2,
910
913
  @connection_timeout=2,
911
914
  @default_validation_type=:smtp,
912
- @email_pattern=/(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@((?i-mx:[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}))\z)/,
915
+ @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)/,
913
916
  @response_timeout=2,
914
917
  @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
915
918
  @smtp_safe_check=false,
@@ -969,6 +972,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
969
972
 
970
973
  Everyone interacting in the Truemail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
971
974
 
975
+ ## Credits
976
+
977
+ - [The Contributors](https://github.com/rubygarage/truemail/graphs/contributors) for code and awesome suggestions
978
+ - [The Stargazers](https://github.com/rubygarage/truemail/stargazers) for showing their support
979
+
972
980
  ## Versioning
973
981
 
974
982
  Truemail uses [Semantic Versioning 2.0.0](https://semver.org)
@@ -9,17 +9,28 @@ module Truemail
9
9
  require 'truemail/validator'
10
10
  require 'truemail/logger'
11
11
 
12
- class ConfigurationError < StandardError; end
12
+ ConfigurationError = Class.new(StandardError)
13
13
 
14
- class ArgumentError < StandardError
14
+ ArgumentError = Class.new(StandardError) do
15
15
  def initialize(current_param, class_name)
16
16
  super("#{current_param} is not a valid #{class_name}")
17
17
  end
18
18
  end
19
19
 
20
+ PunycodeRepresenter = Class.new do
21
+ require 'simpleidn'
22
+
23
+ def self.call(email)
24
+ return unless email.is_a?(String)
25
+ return email if email.ascii_only?
26
+ user, domain = email.split('@')
27
+ "#{user}@#{SimpleIDN.to_ascii(domain.downcase)}"
28
+ end
29
+ end
30
+
20
31
  module RegexConstant
21
- REGEX_DOMAIN = /[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,63}/i.freeze
22
- REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([a-zA-Z0-9]+[\w|\-|\.|\+]*)@(#{REGEX_DOMAIN})\z)/.freeze
32
+ REGEX_DOMAIN = /[\p{L}0-9]+([\-\.]{1}[\p{L}0-9]+)*\.[\p{L}]{2,63}/i.freeze
33
+ REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-|\.|\+]*)@(#{REGEX_DOMAIN})\z)/.freeze
23
34
  REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
24
35
  REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
25
36
  REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'logger'
4
-
5
3
  module Truemail
6
4
  class Logger
5
+ require 'logger'
6
+
7
7
  attr_reader :event, :stdout, :file
8
8
 
9
9
  def initialize(event, error_stdout, log_absolute_path)
@@ -10,7 +10,7 @@ module Truemail
10
10
 
11
11
  def run
12
12
  return false unless Truemail::Validate::Regex.check(result)
13
- result.domain = result.email[Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL, 1]
13
+ result.domain = result.punycode_email[Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL, 1]
14
14
  return true if success(mx_lookup && domain_not_include_null_mx)
15
15
  mail_servers.clear && add_error(Truemail::Validate::Mx::ERROR)
16
16
  false
@@ -40,7 +40,7 @@ module Truemail
40
40
  def establish_smtp_connection
41
41
  mail_servers.each do |mail_server|
42
42
  smtp_results << Truemail::Validate::Smtp::Request.new(
43
- configuration: configuration, host: mail_server, email: result.email, **attempts
43
+ configuration: configuration, host: mail_server, email: result.punycode_email, **attempts
44
44
  )
45
45
  next unless request.check_port
46
46
  request.run || rcptto_error ? break : next
@@ -9,6 +9,10 @@ module Truemail
9
9
  def initialize(errors: {}, mail_servers: [], **args)
10
10
  super
11
11
  end
12
+
13
+ def punycode_email
14
+ @punycode_email ||= Truemail::PunycodeRepresenter.call(email)
15
+ end
12
16
  alias_method :valid?, :success
13
17
  end
14
18
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '1.4.2'
4
+ VERSION = '1.5.0'
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['admin@bestweb.com.ua']
12
12
 
13
13
  spec.summary = %(truemail)
14
- spec.description = %(Configurable plain Ruby email validator. Verify email via Regex, DNS and SMTP. Be sure that email address exists.)
14
+ spec.description = %(Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP.)
15
15
 
16
16
  spec.homepage = 'https://github.com/rubygarage/truemail'
17
17
  spec.license = 'MIT'
@@ -23,19 +23,21 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
+ spec.add_runtime_dependency 'simpleidn', '~> 0.1.1'
27
+
26
28
  spec.add_development_dependency 'bundler', '~> 1.16'
27
29
  spec.add_development_dependency 'bundler-audit', '~> 0.6.1'
28
30
  spec.add_development_dependency 'fasterer', '~> 0.8.1'
29
31
  spec.add_development_dependency 'ffaker', '~> 2.13'
30
32
  spec.add_development_dependency 'json_matchers', '~> 0.11.1'
31
- spec.add_development_dependency 'overcommit', '~> 0.51.0'
33
+ spec.add_development_dependency 'overcommit', '~> 0.52.0'
32
34
  spec.add_development_dependency 'pry-byebug', '~> 3.7'
33
35
  spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
34
36
  spec.add_development_dependency 'reek', '~> 5.5'
35
37
  spec.add_development_dependency 'rspec', '~> 3.9'
36
- spec.add_development_dependency 'rubocop', '~> 0.76.0'
37
- spec.add_development_dependency 'rubocop-performance', '~> 1.5', '>= 1.5.1'
38
- spec.add_development_dependency 'rubocop-rspec', '~> 1.37'
38
+ spec.add_development_dependency 'rubocop', '~> 0.78.0'
39
+ spec.add_development_dependency 'rubocop-performance', '~> 1.5', '>= 1.5.2'
40
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.37', '>= 1.37.1'
39
41
  spec.add_development_dependency 'simplecov', '~> 0.17.1'
40
42
  spec.add_development_dependency 'truemail-rspec', '~> 0.1.1'
41
43
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truemail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.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: 2019-11-27 00:00:00.000000000 Z
11
+ date: 2019-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: simpleidn
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 0.51.0
103
+ version: 0.52.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 0.51.0
110
+ version: 0.52.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: pry-byebug
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -162,14 +176,14 @@ dependencies:
162
176
  requirements:
163
177
  - - "~>"
164
178
  - !ruby/object:Gem::Version
165
- version: 0.76.0
179
+ version: 0.78.0
166
180
  type: :development
167
181
  prerelease: false
168
182
  version_requirements: !ruby/object:Gem::Requirement
169
183
  requirements:
170
184
  - - "~>"
171
185
  - !ruby/object:Gem::Version
172
- version: 0.76.0
186
+ version: 0.78.0
173
187
  - !ruby/object:Gem::Dependency
174
188
  name: rubocop-performance
175
189
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +193,7 @@ dependencies:
179
193
  version: '1.5'
180
194
  - - ">="
181
195
  - !ruby/object:Gem::Version
182
- version: 1.5.1
196
+ version: 1.5.2
183
197
  type: :development
184
198
  prerelease: false
185
199
  version_requirements: !ruby/object:Gem::Requirement
@@ -189,7 +203,7 @@ dependencies:
189
203
  version: '1.5'
190
204
  - - ">="
191
205
  - !ruby/object:Gem::Version
192
- version: 1.5.1
206
+ version: 1.5.2
193
207
  - !ruby/object:Gem::Dependency
194
208
  name: rubocop-rspec
195
209
  requirement: !ruby/object:Gem::Requirement
@@ -197,6 +211,9 @@ dependencies:
197
211
  - - "~>"
198
212
  - !ruby/object:Gem::Version
199
213
  version: '1.37'
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: 1.37.1
200
217
  type: :development
201
218
  prerelease: false
202
219
  version_requirements: !ruby/object:Gem::Requirement
@@ -204,6 +221,9 @@ dependencies:
204
221
  - - "~>"
205
222
  - !ruby/object:Gem::Version
206
223
  version: '1.37'
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: 1.37.1
207
227
  - !ruby/object:Gem::Dependency
208
228
  name: simplecov
209
229
  requirement: !ruby/object:Gem::Requirement
@@ -232,8 +252,8 @@ dependencies:
232
252
  - - "~>"
233
253
  - !ruby/object:Gem::Version
234
254
  version: 0.1.1
235
- description: Configurable plain Ruby email validator. Verify email via Regex, DNS
236
- and SMTP. Be sure that email address exists.
255
+ description: Configurable framework agnostic plain Ruby email validator. Verify email
256
+ via Regex, DNS and SMTP.
237
257
  email:
238
258
  - admin@bestweb.com.ua
239
259
  executables: []