truemail 1.9.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.codeclimate.yml +1 -1
- data/.github/BRANCH_NAMING_CONVENTION.md +36 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- data/.github/{ISSUE_TEMPLATE.md → ISSUE_TEMPLATE/issue_report.md} +17 -6
- data/.github/ISSUE_TEMPLATE/question.md +22 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +4 -1
- data/.rubocop.yml +51 -0
- data/CHANGELOG.md +88 -27
- data/CONTRIBUTING.md +15 -14
- data/Gemfile.lock +33 -32
- data/README.md +32 -30
- data/lib/truemail.rb +9 -2
- data/lib/truemail/core.rb +2 -1
- data/lib/truemail/validate/mx.rb +1 -1
- data/lib/truemail/validate/smtp/request.rb +2 -3
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +9 -9
- metadata +21 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97288083bd45ad7d2c72816ee979f166795806193a7df46a43a4a9b9e657cef
|
4
|
+
data.tar.gz: 0e332a857d8639513d71c1876de23406f6ec531174d40fbd160cedc3fcc443f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7ee9a4a07c04e44b8db3ab346ce190bbaf441cf7e68202cd60b3766c4fd3cf1f9003a7d4d35023a8b87d7864be4d2d8f01580ab4cd291f3e265107e9a947455
|
7
|
+
data.tar.gz: c8ec35b9b9491853303a5c49c2bfdd06111ff713c710f3058178c691daa55d9b8ff75bdd47099c91b30bd2d90bdd4b5f4fd35077fd4adcb0578cdae9909066a6
|
data/.circleci/config.yml
CHANGED
@@ -3,7 +3,7 @@ defaults: &defaults
|
|
3
3
|
docker:
|
4
4
|
- image: circleci/ruby:2.5.0-node
|
5
5
|
environment:
|
6
|
-
CC_TEST_REPORTER_ID:
|
6
|
+
CC_TEST_REPORTER_ID: 693272a1328521f6f7c09d7ffd419b21c00410da26e98e94c687fdd38b26e2cb
|
7
7
|
|
8
8
|
references:
|
9
9
|
restore_bundle_cache: &restore_bundle_cache
|
data/.codeclimate.yml
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Branch naming convention
|
2
|
+
|
3
|
+
## Branch naming
|
4
|
+
|
5
|
+
> Please note for new pull requests create new branches from current `develop` branch only.
|
6
|
+
|
7
|
+
Branch name should include type of your contribution and context. Please follow next pattern for naming your branches:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
feature/add-some-feature
|
11
|
+
technical/some-technical-improvements
|
12
|
+
bugfix/fix-some-bug-name
|
13
|
+
```
|
14
|
+
|
15
|
+
## Before PR actions
|
16
|
+
|
17
|
+
### Squash commits
|
18
|
+
|
19
|
+
Please squash all branch commits into the one before openning your PR from your fork. It's simple to do with the git:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
git rebase -i [hash your first commit of your branch]~1
|
23
|
+
git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example
|
24
|
+
```
|
25
|
+
|
26
|
+
### Add commit description
|
27
|
+
|
28
|
+
Please complete your commit description folowing next pattern:
|
29
|
+
|
30
|
+
```
|
31
|
+
Technical/Add info files # should be the same name as your branch name
|
32
|
+
|
33
|
+
* Added license, changelog, contributing, code of conduct docs
|
34
|
+
* Added GitHub templates
|
35
|
+
* Updated project license link
|
36
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: "[BUG] Your bug report title here"
|
5
|
+
labels: bug
|
6
|
+
assignees: bestwebua
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!-- Thanks for helping to make Truemail better! Before submit your bug, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
|
11
|
+
|
12
|
+
### New bug checklist
|
13
|
+
|
14
|
+
- [ ] I have updated `truemail` to the latest version
|
15
|
+
- [ ] I have read the [Contribution Guidelines](https://github.com/truemail-rb/truemail/blob/master/CONTRIBUTING.md)
|
16
|
+
- [ ] I have read the [documentation](https://truemail-rb.org/truemail-gem)
|
17
|
+
- [ ] I have searched for [existing GitHub issues](https://github.com/truemail-rb/truemail/issues)
|
18
|
+
|
19
|
+
<!-- Please use next pattern for your bug report title: [BUG] Your bug report title here -->
|
20
|
+
|
21
|
+
### Bug description
|
22
|
+
<!-- Please include what's happening, expected behavior, and any relevant code samples -->
|
23
|
+
|
24
|
+
##### Complete output when running truemail, including the stack trace and command used
|
25
|
+
|
26
|
+
<details>
|
27
|
+
<pre>[INSERT OUTPUT HERE]</pre>
|
28
|
+
</details>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for Truemail
|
4
|
+
title: "[FEATURE] Your feature request title here"
|
5
|
+
labels: enhancement
|
6
|
+
assignees: bestwebua
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!-- Thanks for helping to make Truemail better! Before submit your new feature request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
|
11
|
+
|
12
|
+
### New feature request checklist
|
13
|
+
|
14
|
+
- [ ] I have updated `truemail` to the latest version
|
15
|
+
- [ ] I have read the [Contribution Guidelines](https://github.com/truemail-rb/truemail/blob/master/CONTRIBUTING.md)
|
16
|
+
- [ ] I have read the [documentation](https://truemail-rb.org/truemail-gem)
|
17
|
+
- [ ] I have searched for [existing GitHub issues](https://github.com/truemail-rb/truemail/issues)
|
18
|
+
|
19
|
+
<!-- Please use next pattern for your feature request title: [FEATURE] Your feature request title here -->
|
20
|
+
|
21
|
+
### Feature description
|
22
|
+
|
23
|
+
<!-- Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
24
|
+
|
25
|
+
Describe the solution you'd like. A clear and concise description of what you want to happen.
|
26
|
+
|
27
|
+
Describe alternatives you've considered. A clear and concise description of any alternative solutions or features you've considered. -->
|
@@ -1,13 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: Issue report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: "[ISSUE] Your issue report title here"
|
5
|
+
labels: ''
|
6
|
+
assignees: bestwebua
|
7
|
+
|
8
|
+
---
|
9
|
+
|
1
10
|
<!-- Thanks for helping to make Truemail better! Before submit your issue, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
|
2
11
|
|
3
|
-
### New
|
12
|
+
### New issue checklist
|
13
|
+
|
14
|
+
- [ ] I have updated `truemail` to the latest version
|
15
|
+
- [ ] I have read the [Contribution Guidelines](https://github.com/truemail-rb/truemail/blob/master/CONTRIBUTING.md)
|
16
|
+
- [ ] I have read the [documentation](https://truemail-rb.org/truemail-gem)
|
17
|
+
- [ ] I have searched for [existing GitHub issues](https://github.com/truemail-rb/truemail/issues)
|
4
18
|
|
5
|
-
|
6
|
-
- [ ] I have read the [Contribution Guidelines](https://github.com/rubygarage/truemail/blob/master/CONTRIBUTING.md)
|
7
|
-
- [ ] I have read the [documentation](https://github.com/rubygarage/truemail/blob/master/README.md)
|
8
|
-
- [ ] I have searched for [existing GitHub issues](https://github.com/rubygarage/truemail/issues)
|
19
|
+
<!-- Please use next pattern for your issue report title: [ISSUE] Your issue report title here -->
|
9
20
|
|
10
|
-
### Issue
|
21
|
+
### Issue description
|
11
22
|
<!-- Please include what's happening, expected behavior, and any relevant code samples -->
|
12
23
|
|
13
24
|
##### Complete output when running truemail, including the stack trace and command used
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
name: Question
|
3
|
+
about: Ask your question to Truemail team
|
4
|
+
title: "[QUESTION] Your question title here"
|
5
|
+
labels: question
|
6
|
+
assignees: bestwebua
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!-- Thanks for helping to make Truemail better! Before submit your question, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
|
11
|
+
|
12
|
+
### New question checklist
|
13
|
+
|
14
|
+
- [ ] I have read the [Contribution Guidelines](https://github.com/truemail-rb/truemail/blob/master/CONTRIBUTING.md)
|
15
|
+
- [ ] I have read the [documentation](https://truemail-rb.org/truemail-gem)
|
16
|
+
- [ ] I have searched for [existing GitHub issues](https://github.com/truemail-rb/truemail/issues)
|
17
|
+
|
18
|
+
<!-- Please use next pattern for your question title: [QUESTION] Your question title here -->
|
19
|
+
|
20
|
+
### Question
|
21
|
+
|
22
|
+
<!-- Your question context here -->
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# PR Details
|
2
2
|
|
3
3
|
<!-- Provide a general summary of your changes in the Title above -->
|
4
|
+
<!-- PR name should the same name as your branch name, example: -->
|
5
|
+
<!-- Branch name is: feature/add-some-feature -->
|
6
|
+
<!-- PR name should be: Feature/Add some feature -->
|
4
7
|
|
5
8
|
## Description
|
6
9
|
|
@@ -40,7 +43,7 @@
|
|
40
43
|
- [ ] My code follows the code style of this project
|
41
44
|
- [ ] My change requires a change to the documentation
|
42
45
|
- [ ] I have updated the documentation accordingly
|
43
|
-
- [ ] I have read the [**CONTRIBUTING** document](https://github.com/
|
46
|
+
- [ ] I have read the [**CONTRIBUTING** document](https://github.com/truemail-rb/truemail/blob/master/CONTRIBUTING.md)
|
44
47
|
- [ ] I have added tests to cover my changes
|
45
48
|
- [ ] I have run `bundle exec rspec` from the root directory to see all new and existing tests pass
|
46
49
|
- [ ] I have run `rubocop` and `reek` to ensure the code style is valid
|
data/.rubocop.yml
CHANGED
@@ -115,6 +115,27 @@ Style/RedundantSelfAssignment:
|
|
115
115
|
Style/SoleNestedConditional:
|
116
116
|
Enabled: true
|
117
117
|
|
118
|
+
Style/ClassEqualityComparison:
|
119
|
+
Enabled: true
|
120
|
+
|
121
|
+
Style/ArgumentsForwarding:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
Style/CollectionCompact:
|
125
|
+
Enabled: true
|
126
|
+
|
127
|
+
Style/DocumentDynamicEvalDefinition:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Style/NegatedIfElseCondition:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Style/NilLambda:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Style/SwapValues:
|
137
|
+
Enabled: true
|
138
|
+
|
118
139
|
Layout/LineLength:
|
119
140
|
Max: 140
|
120
141
|
|
@@ -212,6 +233,33 @@ Lint/UselessMethodDefinition:
|
|
212
233
|
Lint/UselessTimes:
|
213
234
|
Enabled: true
|
214
235
|
|
236
|
+
Lint/HashCompareByIdentity:
|
237
|
+
Enabled: true
|
238
|
+
|
239
|
+
Lint/RedundantSafeNavigation:
|
240
|
+
Enabled: true
|
241
|
+
|
242
|
+
Lint/DuplicateBranch:
|
243
|
+
Enabled: true
|
244
|
+
|
245
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
246
|
+
Enabled: true
|
247
|
+
|
248
|
+
Lint/EmptyBlock:
|
249
|
+
Enabled: true
|
250
|
+
|
251
|
+
Lint/EmptyClass:
|
252
|
+
Enabled: true
|
253
|
+
|
254
|
+
Lint/NoReturnInBeginEndBlocks:
|
255
|
+
Enabled: false
|
256
|
+
|
257
|
+
Lint/ToEnumArguments:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Lint/UnmodifiedReduceAccumulator:
|
261
|
+
Enabled: true
|
262
|
+
|
215
263
|
Performance/AncestorsInclude:
|
216
264
|
Enabled: true
|
217
265
|
|
@@ -265,3 +313,6 @@ RSpec/MultipleDescribes:
|
|
265
313
|
|
266
314
|
RSpec/MultipleMemoizedHelpers:
|
267
315
|
Enabled: false
|
316
|
+
|
317
|
+
RSpec/StubbedMock:
|
318
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,69 @@
|
|
2
2
|
|
3
3
|
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).
|
4
4
|
|
5
|
+
## [2.1.0] - 2020.11.21
|
6
|
+
|
7
|
+
Collecting only unique ip-addresses for target mail servers. This update should reduce email validation time for case when remote server have closed connection via avoiding connection attempt to server with the same ip address.
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Updated `Truemail::Validate::Mx#fetch_target_hosts`
|
12
|
+
|
13
|
+
## [2.0.2] - 2020.11.14
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
Timeouts time units in `Setting global configuration` of Truemail documentation's section. Thanks to [@wikiti](https://github.com/wikiti) for report.
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- Refactored `Truemail::RegexConstant::REGEX_EMAIL_PATTERN`
|
22
|
+
- Updated gem development dependencies
|
23
|
+
- Updated gem documentation
|
24
|
+
|
25
|
+
## [2.0.1] - 2020.10.20
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
|
29
|
+
- Updated gem development dependencies
|
30
|
+
- Updated gem documentation
|
31
|
+
|
32
|
+
## [2.0.0] - 2020.10.19
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
|
36
|
+
SMTP connection errors: invalid `HELO` hostname (`localhost`), duplicate `HELO` (`verifier domain`). Thanks to [@nenoganchev](https://github.com/nenoganchev) for report.
|
37
|
+
|
38
|
+
### Changed
|
39
|
+
|
40
|
+
- Updated `Truemail::Validate::Smtp::Request#run`
|
41
|
+
- Updated `Truemail::Validate::Smtp::Request#session_data`
|
42
|
+
- Updated `Truemail::Validate::Smtp::Response`
|
43
|
+
|
44
|
+
Now `helo` is a `Boolean` instead of `Net::SMTP::Response` instance. It was changed because `helo` is sending during SMTP-session initializing (`Net::SMTP.new.start`), and `helo` is always `true` if session up is okay. Also `hello` response won't logged as error if it happens. Example of `Truemail::Validate::Smtp::Response` instance from 2.x version.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
#<struct Truemail::Validate::Smtp::Response:0x00007fa74704cd10
|
48
|
+
port_opened=true,
|
49
|
+
connection=true,
|
50
|
+
helo=true, # Returns Boolean instead of Net::SMTP::Response instance
|
51
|
+
mailfrom=false,
|
52
|
+
rcptto=nil,
|
53
|
+
errors={:mailfrom=>"server response timeout"}>
|
54
|
+
```
|
55
|
+
|
56
|
+
## [1.9.2] - 2020.10.02
|
57
|
+
|
58
|
+
### Added
|
59
|
+
|
60
|
+
- `Truemail::TypeError`
|
61
|
+
- error handling for invalid types as input email
|
62
|
+
|
63
|
+
### Changed
|
64
|
+
|
65
|
+
- Updated `Truemail.validate`
|
66
|
+
- Updated `Truemail.valid?`
|
67
|
+
|
5
68
|
## [1.9.1] - 2020.09.21
|
6
69
|
|
7
70
|
### Changed
|
@@ -343,6 +406,7 @@ Truemail.validate('email@white-domain.com', with: :regex)
|
|
343
406
|
smtp_debug=nil>,
|
344
407
|
@validation_type=:regex>
|
345
408
|
```
|
409
|
+
|
346
410
|
**Email hasn't whitelisted domain**
|
347
411
|
|
348
412
|
```ruby
|
@@ -368,9 +432,9 @@ Truemail.validate('email@domain.com', with: :regex)
|
|
368
432
|
|
369
433
|
### Added
|
370
434
|
|
371
|
-
- Configurable default validation type, [issue details](https://github.com/
|
435
|
+
- Configurable default validation type, [issue details](https://github.com/truemail-rb/truemail/issues/48)
|
372
436
|
|
373
|
-
You can predefine default validation type for
|
437
|
+
You can predefine default validation type for `Truemail.validate('email@email.com')` call without with-parameter. Available validation types: `:regex`, `:mx`, `:smtp`. By default validation type still remains `:smtp`
|
374
438
|
|
375
439
|
```ruby
|
376
440
|
Truemail.configure do |config|
|
@@ -425,7 +489,7 @@ Truemail.validate('email@black-domain.com')
|
|
425
489
|
|
426
490
|
### Added
|
427
491
|
|
428
|
-
- Feature domain whitelist blacklist. Other validations will not processed even if it was defined in
|
492
|
+
- Feature domain whitelist blacklist. Other validations will not processed even if it was defined in `validation_type_for`.
|
429
493
|
|
430
494
|
```ruby
|
431
495
|
Truemail.configure do |config|
|
@@ -448,7 +512,7 @@ Truemail.configuration.blacklisted_domains = ['somedomain1.com', 'somedomain2.co
|
|
448
512
|
|
449
513
|
### Removed
|
450
514
|
|
451
|
-
-
|
515
|
+
- `:skip` validation type for `validation_type_for`
|
452
516
|
|
453
517
|
### Fixed
|
454
518
|
|
@@ -463,7 +527,7 @@ Truemail.configuration.blacklisted_domains = ['somedomain1.com', 'somedomain2.co
|
|
463
527
|
|
464
528
|
### Added
|
465
529
|
|
466
|
-
- skip validation by domain for validation_type_for configuration option:
|
530
|
+
- skip validation by domain for `validation_type_for` configuration option:
|
467
531
|
|
468
532
|
```ruby
|
469
533
|
Truemail.configure do |config|
|
@@ -486,7 +550,7 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
486
550
|
|
487
551
|
### Added
|
488
552
|
|
489
|
-
- SMTP error body configurable option, [issue details](https://github.com/
|
553
|
+
- SMTP error body configurable option, [issue details](https://github.com/truemail-rb/truemail/issues/19)
|
490
554
|
|
491
555
|
### Changed
|
492
556
|
|
@@ -503,11 +567,11 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
503
567
|
|
504
568
|
### Added
|
505
569
|
|
506
|
-
- Reverse trace, [issue details](https://github.com/
|
570
|
+
- Reverse trace, [issue details](https://github.com/truemail-rb/truemail/issues/18)
|
507
571
|
|
508
572
|
### Fixed
|
509
573
|
|
510
|
-
- Behaviour of current host address resolver, [issue details](https://github.com/
|
574
|
+
- Behaviour of current host address resolver, [issue details](https://github.com/truemail-rb/truemail/issues/18)
|
511
575
|
|
512
576
|
### Changed
|
513
577
|
|
@@ -518,7 +582,7 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
518
582
|
|
519
583
|
### Added
|
520
584
|
|
521
|
-
- PTR record audit, [issue details](https://github.com/
|
585
|
+
- PTR record audit, [issue details](https://github.com/truemail-rb/truemail/issues/18)
|
522
586
|
|
523
587
|
### Changed
|
524
588
|
|
@@ -529,12 +593,12 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
529
593
|
|
530
594
|
### Added
|
531
595
|
|
532
|
-
- MX gem logic with [RFC 7505](https://tools.ietf.org/html/rfc7505), null MX record supporting, [issue details](https://github.com/
|
596
|
+
- MX gem logic with [RFC 7505](https://tools.ietf.org/html/rfc7505), null MX record supporting, [issue details](https://github.com/truemail-rb/truemail/issues/27)
|
533
597
|
- [Contributing guideline](CONTRIBUTING.md)
|
534
598
|
|
535
599
|
### Fixed
|
536
600
|
|
537
|
-
- Multihomed MX records supporting, [issue details](https://github.com/
|
601
|
+
- Multihomed MX records supporting, [issue details](https://github.com/truemail-rb/truemail/issues/28)
|
538
602
|
|
539
603
|
### Changed
|
540
604
|
|
@@ -545,11 +609,11 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
545
609
|
|
546
610
|
### Added
|
547
611
|
|
548
|
-
- Retries for
|
612
|
+
- Retries for `Truemail::Validate::Smtp` for cases when one mx server
|
549
613
|
|
550
614
|
### Changed
|
551
615
|
|
552
|
-
-
|
616
|
+
- `Truemail::Configuration` class, please use `.connection_attempts` instead `.retry_count`
|
553
617
|
- `Truemail::VERSION`
|
554
618
|
- gem documentation
|
555
619
|
|
@@ -557,12 +621,12 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
557
621
|
|
558
622
|
### Added
|
559
623
|
|
560
|
-
- Checking A record presence if
|
561
|
-
- Handling of
|
562
|
-
- Checking A record if
|
563
|
-
- Supporting of multihomed MX records, conversion host names to ips, [issue details](https://github.com/
|
564
|
-
- Timeout configuration for DNS resolver, [issue details](https://github.com/
|
565
|
-
-
|
624
|
+
- Checking A record presence if `MX` and `CNAME` records not exist, [issue details](https://github.com/truemail-rb/truemail/issues/10)
|
625
|
+
- Handling of `CNAME` records, [issue details](https://github.com/truemail-rb/truemail/issues/11)
|
626
|
+
- Checking A record if `MX` and `CNAME` records not found, [issue details](https://github.com/truemail-rb/truemail/issues/12)
|
627
|
+
- Supporting of multihomed MX records, conversion host names to ips, [issue details](https://github.com/truemail-rb/truemail/issues/17)
|
628
|
+
- Timeout configuration for DNS resolver, [issue details](https://github.com/truemail-rb/truemail/issues/13)
|
629
|
+
- `.valid?` helper
|
566
630
|
|
567
631
|
### Changed
|
568
632
|
|
@@ -573,16 +637,16 @@ Truemail.configuration.validation_type_for = { 'somedomain.com' => :skip }
|
|
573
637
|
|
574
638
|
### Added
|
575
639
|
|
576
|
-
- Independent domain name extractor to
|
640
|
+
- Independent domain name extractor to `Truemail::Validate::Mx#run`
|
577
641
|
|
578
642
|
### Fixed
|
579
643
|
|
580
|
-
- Default
|
644
|
+
- Default `REGEX_EMAIL_PATTERN`, [issue details](https://github.com/truemail-rb/truemail/issues/7)
|
581
645
|
* local part of address can't start with a dot or special symbol
|
582
646
|
* local part of address can include ```+``` symbol
|
583
|
-
- Default
|
647
|
+
- Default `REGEX_DOMAIN_PATTERN`, [issue details](https://github.com/truemail-rb/truemail/issues/8)
|
584
648
|
* TLD size increased up to 63 characters
|
585
|
-
- Case sensitive domain names, [issue details](https://github.com/
|
649
|
+
- Case sensitive domain names, [issue details](https://github.com/truemail-rb/truemail/issues/9)
|
586
650
|
|
587
651
|
### Changed
|
588
652
|
|
@@ -629,10 +693,7 @@ Truemail.validate('email@example.com')
|
|
629
693
|
#<struct Truemail::Validate::Smtp::Response
|
630
694
|
port_opened=true,
|
631
695
|
connection=false,
|
632
|
-
helo=
|
633
|
-
#<Net::SMTP::Response:0x0000000002c934c8
|
634
|
-
@status="250",
|
635
|
-
@string="250 mx1.example.com\n">,
|
696
|
+
helo=true,
|
636
697
|
mailfrom=false,
|
637
698
|
rcptto=nil,
|
638
699
|
errors={:mailfrom=>"554 5.7.1 Client host blocked\n", :connection=>"server dropped connection after response"}>>,]>,
|
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 (1.
|
4
|
+
truemail (2.1.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.
|
31
|
+
overcommit (0.57.0)
|
32
32
|
childprocess (>= 0.6.3, < 5)
|
33
33
|
iniparse (~> 1.4)
|
34
|
-
parallel (1.
|
35
|
-
parser (2.7.
|
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.
|
43
|
+
psych (3.2.0)
|
44
44
|
rainbow (3.0.0)
|
45
45
|
rake (13.0.1)
|
46
|
-
reek (6.0.
|
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
|
49
|
+
psych (~> 3.1)
|
50
50
|
rainbow (>= 2.0, < 4.0)
|
51
|
-
regexp_parser (1.8.
|
51
|
+
regexp_parser (1.8.2)
|
52
52
|
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.
|
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.
|
62
|
-
rspec-mocks (3.
|
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.
|
65
|
-
rspec-support (3.
|
66
|
-
rubocop (
|
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.
|
68
|
+
parser (>= 2.7.1.5)
|
69
69
|
rainbow (>= 2.2.2, < 4.0)
|
70
|
-
regexp_parser (>= 1.
|
70
|
+
regexp_parser (>= 1.8)
|
71
71
|
rexml
|
72
|
-
rubocop-ast (>=
|
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 (
|
76
|
-
parser (>= 2.7.1.
|
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 (
|
81
|
-
rubocop (~> 0
|
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.
|
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.
|
115
|
-
rspec (~> 3.
|
116
|
-
rubocop (~>
|
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 (~>
|
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/
|
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
|
|
@@ -127,7 +135,7 @@ You can use global gem configuration or custom independent configuration. Availa
|
|
127
135
|
|
128
136
|
#### Setting global configuration
|
129
137
|
|
130
|
-
To have an access for
|
138
|
+
To have an access for `Truemail.configuration` and gem configuration features, you must configure it first as in the example below:
|
131
139
|
|
132
140
|
```ruby
|
133
141
|
require 'truemail'
|
@@ -146,10 +154,12 @@ Truemail.configure do |config|
|
|
146
154
|
# Optional parameter. You can override default regex pattern
|
147
155
|
config.smtp_error_body_pattern = /regex_pattern/
|
148
156
|
|
149
|
-
# Optional parameter. Connection timeout
|
157
|
+
# Optional parameter. Connection timeout in seconds.
|
158
|
+
# It is equal to 2 by default.
|
150
159
|
config.connection_timeout = 1
|
151
160
|
|
152
|
-
# Optional parameter. A SMTP server response timeout
|
161
|
+
# Optional parameter. A SMTP server response timeout in seconds.
|
162
|
+
# It is equal to 2 by default.
|
153
163
|
config.response_timeout = 1
|
154
164
|
|
155
165
|
# Optional parameter. Total of connection attempts. It is equal to 2 by default.
|
@@ -289,11 +299,12 @@ Please note, you should have global or custom configuration for use Truemail gem
|
|
289
299
|
|
290
300
|
#### Whitelist/Blacklist check
|
291
301
|
|
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
|
302
|
+
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
303
|
|
294
|
-
Please note, other validations will not processed even if it was defined in
|
304
|
+
Please note, other validations will not processed even if it was defined in `validation_type_for`.
|
295
305
|
|
296
306
|
**Sequence of domain list check:**
|
307
|
+
|
297
308
|
1. Whitelist check
|
298
309
|
2. Whitelist validation check
|
299
310
|
3. Blacklist check
|
@@ -356,8 +367,7 @@ Truemail.configure do |config|
|
|
356
367
|
end
|
357
368
|
```
|
358
369
|
|
359
|
-
When email domain in whitelist and
|
360
|
-
Validation of email which not contains whitelisted domain always will return ```false```.
|
370
|
+
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
371
|
|
362
372
|
###### Email has whitelisted domain
|
363
373
|
|
@@ -459,7 +469,7 @@ Truemail.validate('email@black-domain.com')
|
|
459
469
|
|
460
470
|
##### Duplication case
|
461
471
|
|
462
|
-
Validation result for this email returns
|
472
|
+
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
473
|
|
464
474
|
```ruby
|
465
475
|
Truemail.validate('email@somedomain.com')
|
@@ -591,7 +601,7 @@ In fact it's DNS validation because it checks not MX records only. DNS validatio
|
|
591
601
|
[Whitelist/Blacklist] -> [Regex validation] -> [MX validation]
|
592
602
|
```
|
593
603
|
|
594
|
-
Please note, Truemail MX validator [not performs](https://github.com/
|
604
|
+
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
605
|
|
596
606
|
##### RFC MX lookup flow
|
597
607
|
|
@@ -688,13 +698,13 @@ SMTP validation is a final, third validation level. This type of validation trie
|
|
688
698
|
[Whitelist/Blacklist] -> [Regex validation] -> [MX validation] -> [SMTP validation]
|
689
699
|
```
|
690
700
|
|
691
|
-
If total count of MX servers is equal to one,
|
701
|
+
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
702
|
|
693
703
|
By default, you don't need pass with-parameter to use it. Example of usage is specified below:
|
694
704
|
|
695
705
|
##### SMTP safe check disabled
|
696
706
|
|
697
|
-
With
|
707
|
+
With `smtp_safe_check = false`
|
698
708
|
|
699
709
|
```ruby
|
700
710
|
require 'truemail'
|
@@ -757,10 +767,7 @@ Truemail.validate('email@example.com')
|
|
757
767
|
#<struct Truemail::Validate::Smtp::Response
|
758
768
|
port_opened=true,
|
759
769
|
connection=true,
|
760
|
-
helo=
|
761
|
-
#<Net::SMTP::Response:0x0000000002d5aca8
|
762
|
-
@status="250",
|
763
|
-
@string="250 127.0.1.1 Hello example.com\n">,
|
770
|
+
helo=true,
|
764
771
|
mailfrom=
|
765
772
|
#<Net::SMTP::Response:0x0000000002d5a618
|
766
773
|
@status="250",
|
@@ -788,7 +795,7 @@ Truemail.validate('email@example.com')
|
|
788
795
|
|
789
796
|
##### SMTP safe check enabled
|
790
797
|
|
791
|
-
With
|
798
|
+
With `smtp_safe_check = true`
|
792
799
|
|
793
800
|
```ruby
|
794
801
|
require 'truemail'
|
@@ -824,10 +831,7 @@ Truemail.validate('email@example.com')
|
|
824
831
|
#<struct Truemail::Validate::Smtp::Response
|
825
832
|
port_opened=true,
|
826
833
|
connection=false,
|
827
|
-
helo=
|
828
|
-
#<Net::SMTP::Response:0x0000000002c934c8
|
829
|
-
@status="250",
|
830
|
-
@string="250 127.0.1.1\n">,
|
834
|
+
helo=true,
|
831
835
|
mailfrom=false,
|
832
836
|
rcptto=nil,
|
833
837
|
errors={:mailfrom=>"554 5.7.1 Client host blocked\n", :connection=>"server dropped connection after response"}>>,]>,
|
@@ -873,10 +877,7 @@ Truemail.validate('email@example.com')
|
|
873
877
|
#<struct Truemail::Validate::Smtp::Response
|
874
878
|
port_opened=true,
|
875
879
|
connection=true,
|
876
|
-
helo=
|
877
|
-
#<Net::SMTP::Response:0x0000000002d5aca8
|
878
|
-
@status="250",
|
879
|
-
@string="250 127.0.1.1 Hello example.com\n">,
|
880
|
+
helo=true,
|
880
881
|
mailfrom=#<Net::SMTP::Response:0x0000000002d5a618 @status="250", @string="250 OK\n">,
|
881
882
|
rcptto=false,
|
882
883
|
errors={:rcptto=>"550 User not found\n"}>>]>,
|
@@ -1174,11 +1175,12 @@ All Truemail solutions: https://truemail-rb.org
|
|
1174
1175
|
| [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
1176
|
| [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
|
1176
1177
|
| [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
|
1178
|
+
| [truemail-java-client](https://github.com/truemail-rb/truemail-java-client) | java lib | Web API Java client for Truemail Server |
|
1177
1179
|
| [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
|
1178
1180
|
|
1179
1181
|
## Contributing
|
1180
1182
|
|
1181
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
1183
|
+
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
1184
|
|
1183
1185
|
## License
|
1184
1186
|
|
@@ -1190,8 +1192,8 @@ Everyone interacting in the Truemail project’s codebases, issue trackers, chat
|
|
1190
1192
|
|
1191
1193
|
## Credits
|
1192
1194
|
|
1193
|
-
- [The Contributors](https://github.com/
|
1194
|
-
- [The Stargazers](https://github.com/
|
1195
|
+
- [The Contributors](https://github.com/truemail-rb/truemail/graphs/contributors) for code and awesome suggestions
|
1196
|
+
- [The Stargazers](https://github.com/truemail-rb/truemail/stargazers) for showing their support
|
1195
1197
|
|
1196
1198
|
## Versioning
|
1197
1199
|
|
data/lib/truemail.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative 'truemail/core'
|
|
5
5
|
module Truemail
|
6
6
|
INCOMPLETE_CONFIG = 'verifier_email is required parameter'
|
7
7
|
NOT_CONFIGURED = 'use Truemail.configure before or pass custom configuration'
|
8
|
+
INVALID_TYPE = 'email should be a String'
|
8
9
|
|
9
10
|
class << self
|
10
11
|
def configuration(&block)
|
@@ -25,10 +26,12 @@ module Truemail
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def validate(email, custom_configuration: nil, **options)
|
29
|
+
check_argument_type(email)
|
28
30
|
Truemail::Validator.new(email, configuration: determine_configuration(custom_configuration), **options).run
|
29
31
|
end
|
30
32
|
|
31
33
|
def valid?(email, **options)
|
34
|
+
check_argument_type(email)
|
32
35
|
validate(email, **options).result.valid?
|
33
36
|
end
|
34
37
|
|
@@ -38,8 +41,12 @@ module Truemail
|
|
38
41
|
|
39
42
|
private
|
40
43
|
|
41
|
-
def raise_unless(condition, message)
|
42
|
-
raise
|
44
|
+
def raise_unless(condition, message, error_class = Truemail::ConfigurationError)
|
45
|
+
raise error_class, message unless condition
|
46
|
+
end
|
47
|
+
|
48
|
+
def check_argument_type(argument)
|
49
|
+
raise_unless(argument.is_a?(String), Truemail::INVALID_TYPE, Truemail::TypeError)
|
43
50
|
end
|
44
51
|
|
45
52
|
def determine_configuration(custom_configuration)
|
data/lib/truemail/core.rb
CHANGED
@@ -11,6 +11,7 @@ module Truemail
|
|
11
11
|
require_relative '../truemail/logger'
|
12
12
|
|
13
13
|
ConfigurationError = Class.new(StandardError)
|
14
|
+
TypeError = Class.new(StandardError)
|
14
15
|
|
15
16
|
ArgumentError = Class.new(StandardError) do
|
16
17
|
def initialize(arg_value, arg_name)
|
@@ -31,7 +32,7 @@ module Truemail
|
|
31
32
|
|
32
33
|
module RegexConstant
|
33
34
|
REGEX_DOMAIN = /[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}/i.freeze
|
34
|
-
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w
|
35
|
+
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@(#{REGEX_DOMAIN})\z)/.freeze
|
35
36
|
REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
|
36
37
|
REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
|
37
38
|
REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze
|
data/lib/truemail/validate/mx.rb
CHANGED
@@ -31,8 +31,8 @@ module Truemail
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run
|
34
|
-
session.start do |smtp_request|
|
35
|
-
response.connection = true
|
34
|
+
session.start(configuration.verifier_domain) do |smtp_request|
|
35
|
+
response.connection = response.helo = true
|
36
36
|
smtp_handshakes(smtp_request, response)
|
37
37
|
end
|
38
38
|
rescue => error
|
@@ -83,7 +83,6 @@ module Truemail
|
|
83
83
|
|
84
84
|
def session_data
|
85
85
|
{
|
86
|
-
helo: configuration.verifier_domain,
|
87
86
|
mailfrom: configuration.verifier_email,
|
88
87
|
rcptto: email
|
89
88
|
}
|
data/lib/truemail/version.rb
CHANGED
data/truemail.gemspec
CHANGED
@@ -13,15 +13,15 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = %(truemail)
|
14
14
|
spec.description = %(Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP.)
|
15
15
|
|
16
|
-
spec.homepage = 'https://github.com/
|
16
|
+
spec.homepage = 'https://github.com/truemail-rb/truemail'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
19
|
spec.metadata = {
|
20
20
|
'homepage_uri' => 'https://truemail-rb.org',
|
21
|
-
'changelog_uri' => 'https://github.com/
|
22
|
-
'source_code_uri' => 'https://github.com/
|
21
|
+
'changelog_uri' => 'https://github.com/truemail-rb/truemail/blob/master/CHANGELOG.md',
|
22
|
+
'source_code_uri' => 'https://github.com/truemail-rb/truemail',
|
23
23
|
'documentation_uri' => 'https://truemail-rb.org/truemail-gem',
|
24
|
-
'bug_tracker_uri' => 'https://github.com/
|
24
|
+
'bug_tracker_uri' => 'https://github.com/truemail-rb/truemail/issues'
|
25
25
|
}
|
26
26
|
|
27
27
|
spec.required_ruby_version = '>= 2.5.0'
|
@@ -38,14 +38,14 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'fasterer', '~> 0.8.3'
|
39
39
|
spec.add_development_dependency 'ffaker', '~> 2.17'
|
40
40
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
41
|
-
spec.add_development_dependency 'overcommit', '~> 0.
|
41
|
+
spec.add_development_dependency 'overcommit', '~> 0.57.0'
|
42
42
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
43
43
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
44
|
-
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.
|
45
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
46
|
-
spec.add_development_dependency 'rubocop', '~>
|
44
|
+
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.2'
|
45
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
46
|
+
spec.add_development_dependency 'rubocop', '~> 1.3'
|
47
47
|
spec.add_development_dependency 'rubocop-performance', '~> 1.8', '>= 1.8.1'
|
48
|
-
spec.add_development_dependency 'rubocop-rspec', '~>
|
48
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
49
49
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
50
50
|
spec.add_development_dependency 'truemail-rspec', '~> 0.2.1'
|
51
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.57.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.57.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry-byebug
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
version: '6.0'
|
152
152
|
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: 6.0.
|
154
|
+
version: 6.0.2
|
155
155
|
type: :development
|
156
156
|
prerelease: false
|
157
157
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -161,35 +161,35 @@ dependencies:
|
|
161
161
|
version: '6.0'
|
162
162
|
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version: 6.0.
|
164
|
+
version: 6.0.2
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
166
|
name: rspec
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '3.
|
171
|
+
version: '3.10'
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '3.
|
178
|
+
version: '3.10'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: rubocop
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - "~>"
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
185
|
+
version: '1.3'
|
186
186
|
type: :development
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - "~>"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: '1.3'
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: rubocop-performance
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,20 +216,14 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: 1.43.2
|
219
|
+
version: '2.0'
|
223
220
|
type: :development
|
224
221
|
prerelease: false
|
225
222
|
version_requirements: !ruby/object:Gem::Requirement
|
226
223
|
requirements:
|
227
224
|
- - "~>"
|
228
225
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
230
|
-
- - ">="
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: 1.43.2
|
226
|
+
version: '2.0'
|
233
227
|
- !ruby/object:Gem::Dependency
|
234
228
|
name: simplecov
|
235
229
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,7 +262,11 @@ extra_rdoc_files: []
|
|
268
262
|
files:
|
269
263
|
- ".circleci/config.yml"
|
270
264
|
- ".codeclimate.yml"
|
271
|
-
- ".github/
|
265
|
+
- ".github/BRANCH_NAMING_CONVENTION.md"
|
266
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
267
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
268
|
+
- ".github/ISSUE_TEMPLATE/issue_report.md"
|
269
|
+
- ".github/ISSUE_TEMPLATE/question.md"
|
272
270
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
273
271
|
- ".gitignore"
|
274
272
|
- ".overcommit.yml"
|
@@ -315,15 +313,15 @@ files:
|
|
315
313
|
- lib/truemail/worker.rb
|
316
314
|
- lib/truemail/wrapper.rb
|
317
315
|
- truemail.gemspec
|
318
|
-
homepage: https://github.com/
|
316
|
+
homepage: https://github.com/truemail-rb/truemail
|
319
317
|
licenses:
|
320
318
|
- MIT
|
321
319
|
metadata:
|
322
320
|
homepage_uri: https://truemail-rb.org
|
323
|
-
changelog_uri: https://github.com/
|
324
|
-
source_code_uri: https://github.com/
|
321
|
+
changelog_uri: https://github.com/truemail-rb/truemail/blob/master/CHANGELOG.md
|
322
|
+
source_code_uri: https://github.com/truemail-rb/truemail
|
325
323
|
documentation_uri: https://truemail-rb.org/truemail-gem
|
326
|
-
bug_tracker_uri: https://github.com/
|
324
|
+
bug_tracker_uri: https://github.com/truemail-rb/truemail/issues
|
327
325
|
post_install_message:
|
328
326
|
rdoc_options: []
|
329
327
|
require_paths:
|