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