truemail 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26d3676d287c46be8f5a9d6b62afe0bb8bf9258f49fd2020d08ff12ffbbb3b58
4
- data.tar.gz: cfe874f2fc20513acfd761527fce3ef79eabdd6f020f0a377f6f6cb0027bccd3
3
+ metadata.gz: d2c535ef7ee89b62217b36df966ba3d94422498a0431d87218540d4d12073ad9
4
+ data.tar.gz: 462b13314a2d223d7db3b305d108a8a8f052197fc5cbd311001dfdfea2b6bddc
5
5
  SHA512:
6
- metadata.gz: 795c62d127fdc4d173817db4c3ad3ea70e671dff16fd822777473239b4238206afd4553dbeb8c4cfff98717fef3548d252d27a095aab39e809283ac88fed9070
7
- data.tar.gz: 3e21af180880bedaff7457cdfee47c55bcb9f79562d71eb15aeeb39813f73af880421da7e7c96b5ce569da133c9763471f864b1521ffa8bcb67d3bc9fe4d0dd6
6
+ metadata.gz: b2dc0174969794428067aba261022536cbca33895686b89f88be6ee83d4c5c97caa1e8ea6a28c91277e2204e1b9c33ae412faa26137b1c609886540526a68aac
7
+ data.tar.gz: 01f89de5cb1cbc2f94cbeb82b996bcabd5447b7d2791c985070a8cd053ef936cc961d7d7d4b17902ceda923e870a8c572e6fae55c4148c510eba52e65a931cb9
@@ -0,0 +1,17 @@
1
+ <!-- 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
+
3
+ ### New Issue Checklist
4
+
5
+ - [ ] I have updated truemail to the latest version
6
+ - [ ] I have read the [Contribution Guidelines](../CONTRIBUTING.md)
7
+ - [ ] I have read the [documentation](../README.md)
8
+ - [ ] I have searched for [existing GitHub issues](https://github.com/rubygarage/truemail/issues)
9
+
10
+ ### Issue Description
11
+ <!-- Please include what's happening, expected behavior, and any relevant code samples -->
12
+
13
+ ##### Complete output when running truemail, including the stack trace and command used
14
+
15
+ <details>
16
+ <pre>[INSERT OUTPUT HERE]</pre>
17
+ </details>
@@ -0,0 +1,46 @@
1
+ # PR Details
2
+
3
+ <!-- Provide a general summary of your changes in the Title above -->
4
+
5
+ ## Description
6
+
7
+ <!--- Describe your changes in detail -->
8
+
9
+ ## Related Issue
10
+
11
+ <!--- This project only accepts pull requests related to open issues -->
12
+ <!--- If suggesting a new feature or change, please discuss it in an issue first -->
13
+ <!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
14
+ <!--- Please link to the issue here: -->
15
+
16
+ ## Motivation and Context
17
+
18
+ <!--- Why is this change required? What problem does it solve? -->
19
+
20
+ ## How Has This Been Tested
21
+
22
+ <!--- Please describe in detail how you tested your changes. -->
23
+ <!--- Include details of your testing environment, and the tests you ran to -->
24
+ <!--- see how your change affects other areas of the code, etc. -->
25
+
26
+ ## Types of changes
27
+
28
+ <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
29
+
30
+ - [ ] Docs change / refactoring / dependency upgrade
31
+ - [ ] Bug fix (non-breaking change which fixes an issue)
32
+ - [ ] New feature (non-breaking change which adds functionality)
33
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
34
+
35
+ ## Checklist
36
+
37
+ <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
38
+ <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
39
+
40
+ - [ ] My code follows the code style of this project
41
+ - [ ] My change requires a change to the documentation
42
+ - [ ] I have updated the documentation accordingly
43
+ - [ ] I have read the [**CONTRIBUTING** document](../CONTRIBUTING.md)
44
+ - [ ] I have added tests to cover my changes
45
+ - [ ] I have run `bundle exec rspec` from the root directory to see all new and existing tests pass
46
+ - [ ] I have run `rubocop` and `reek` to ensure the code style is valid
data/.reek.yml CHANGED
@@ -27,7 +27,7 @@ detectors:
27
27
  exclude:
28
28
  - Truemail::Validate::Smtp::Request#compose_from
29
29
  - Truemail::Validator#select_validation_type
30
- - Truemail::Validate::Mx#mx_records
30
+ - Truemail::Validate::Mx#null_mx?
31
31
 
32
32
  ControlParameter:
33
33
  exclude:
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,45 @@
1
+ # Contributing to Truemail
2
+
3
+ Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
4
+
5
+ Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
6
+
7
+ ## Using the issue tracker
8
+
9
+ The issue tracker is the preferred channel for [bug reports](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests).
10
+
11
+ <a name="bugs"></a>
12
+ ## Bug/issue reports
13
+
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!
16
+
17
+ Guidelines for bug reports:
18
+
19
+ 1. **Use the GitHub issue search** &mdash; check if the issue has already been reported
20
+ 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository
21
+ 3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
22
+
23
+ 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
+
25
+ <a name="features"></a>
26
+ ## Feature requests
27
+
28
+ 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
+
30
+ <a name="pull-requests"></a>
31
+ ## Pull requests
32
+
33
+ Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
34
+
35
+ **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
36
+
37
+ Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Not all features proposed will be added but we are open to having a conversation about a feature you are championing.
38
+
39
+ Guidelines for pull requests:
40
+
41
+ 1. Truemail [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
42
+ 2. Fork the repo
43
+ 3. Run the tests. This is to make sure your starting point works. Tests can be run via ```rspec```
44
+ 4. Create a new branch and make your changes. This includes tests for features!
45
+ 5. Push to your fork and submit a pull request
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (0.1.5)
4
+ truemail (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Truemail
2
2
 
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/maintainability)](https://codeclimate.com/github/rubygarage/truemail/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/test_coverage)](https://codeclimate.com/github/rubygarage/truemail/test_coverage) [![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail) [![CircleCI](https://circleci.com/gh/rubygarage/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/rubygarage/truemail/tree/master)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/maintainability)](https://codeclimate.com/github/rubygarage/truemail/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/test_coverage)](https://codeclimate.com/github/rubygarage/truemail/test_coverage) [![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail) [![CircleCI](https://circleci.com/gh/rubygarage/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/rubygarage/truemail/tree/master) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
4
 
5
5
  The Truemail gem helps you validate emails by regex pattern, presence of domain mx-records, and real existence of email account on a current email server.
6
6
 
@@ -170,7 +170,7 @@ require 'truemail'
170
170
 
171
171
  Truemail.configure do |config|
172
172
  config.verifier_email = 'verifier@example.com'
173
- config.config.email_pattern = /regex_pattern/
173
+ config.email_pattern = /regex_pattern/
174
174
  end
175
175
 
176
176
  Truemail.validate('email@example.com', with: :regex)
@@ -195,7 +195,7 @@ Validation by MX records is the second validation level. It uses Regex validatio
195
195
  [Regex validation] -> [MX validation]
196
196
  ```
197
197
 
198
- Truemail MX validation performs strictly following the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard.
198
+ Please note, Truemail MX validator not performs strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
199
199
 
200
200
  Example of usage:
201
201
 
@@ -419,7 +419,7 @@ end
419
419
 
420
420
  ## Contributing
421
421
 
422
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubygarage/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
422
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubygarage/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tikets](https://github.com/rubygarage/truemail/issues). Be shure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
423
423
 
424
424
  ## License
425
425
 
@@ -427,7 +427,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
427
427
 
428
428
  ## Code of Conduct
429
429
 
430
- Everyone interacting in the Truemail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/truemail/blob/master/CODE_OF_CONDUCT.md).
430
+ Everyone interacting in the Truemail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
431
+
432
+ ## Versioning
433
+
434
+ Truemail uses [Semantic Versioning 2.0.0](https://semver.org)
431
435
 
432
436
  ---
433
437
  <a href="https://rubygarage.org/"><img src="https://rubygarage.s3.amazonaws.com/assets/assets/rg_color_logo_horizontal-919afc51a81d2e40cb6a0b43ee832e3fcd49669d06785156d2d16fd0d799f89e.png" alt="RubyGarage Logo" width="415" height="128"></a>
@@ -22,6 +22,10 @@ module Truemail
22
22
  def add_error(message)
23
23
  result.errors[self.class.name.split('::').last.downcase.to_sym] = message
24
24
  end
25
+
26
+ def mail_servers
27
+ result.mail_servers
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -6,12 +6,13 @@ module Truemail
6
6
  require 'resolv'
7
7
 
8
8
  ERROR = 'target host(s) not found'
9
+ NULL_MX_RECORD = 'null_mx_record'
9
10
 
10
11
  def run
11
12
  return false unless Truemail::Validate::Regex.check(result)
12
13
  result.domain = result.email[Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL, 1]
13
- return true if success(mx_lookup)
14
- add_error(Truemail::Validate::Mx::ERROR)
14
+ return true if success(mx_lookup && domain_not_include_null_mx)
15
+ mail_servers.clear && add_error(Truemail::Validate::Mx::ERROR)
15
16
  false
16
17
  end
17
18
 
@@ -28,17 +29,28 @@ module Truemail
28
29
  end
29
30
 
30
31
  def fetch_target_hosts(hosts)
31
- result.mail_servers.push(*hosts)
32
+ mail_servers.push(*hosts)
33
+ end
34
+
35
+ def null_mx?(domain_mx_records)
36
+ mx_record = domain_mx_records.first
37
+ domain_mx_records.one? && mx_record.preference.zero? && mx_record.exchange.to_s.empty?
38
+ end
39
+
40
+ def domain_not_include_null_mx
41
+ !mail_servers.include?(Truemail::Validate::Mx::NULL_MX_RECORD)
32
42
  end
33
43
 
34
44
  def mx_records(domain)
35
- Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX).sort_by(&:preference).map do |mx_record|
36
- Resolv.getaddress(mx_record.exchange.to_s)
37
- end
45
+ domain_mx_records = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX)
46
+ return [Truemail::Validate::Mx::NULL_MX_RECORD] if null_mx?(domain_mx_records)
47
+ domain_mx_records.sort_by(&:preference).map do |mx_record|
48
+ Resolv.getaddresses(mx_record.exchange.to_s)
49
+ end.flatten
38
50
  end
39
51
 
40
52
  def mail_servers_found?
41
- !result.mail_servers.empty?
53
+ !mail_servers.empty?
42
54
  end
43
55
 
44
56
  def hosts_from_mx_records?
@@ -29,10 +29,6 @@ module Truemail
29
29
  smtp_results.last
30
30
  end
31
31
 
32
- def mail_servers
33
- result.mail_servers
34
- end
35
-
36
32
  def attempts
37
33
  @attempts ||=
38
34
  mail_servers.one? ? { attempts: Truemail.configuration.connection_attempts } : {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  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: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Trotsenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-05 00:00:00.000000000 Z
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -174,6 +174,8 @@ extra_rdoc_files: []
174
174
  files:
175
175
  - ".circleci/config.yml"
176
176
  - ".codeclimate.yml"
177
+ - ".github/ISSUE_TEMPLATE.md"
178
+ - ".github/PULL_REQUEST_TEMPLATE.md"
177
179
  - ".gitignore"
178
180
  - ".overcommit.yml"
179
181
  - ".reek.yml"
@@ -182,6 +184,7 @@ files:
182
184
  - ".ruby-gemset"
183
185
  - ".ruby-version"
184
186
  - CODE_OF_CONDUCT.md
187
+ - CONTRIBUTING.md
185
188
  - Gemfile
186
189
  - Gemfile.lock
187
190
  - LICENSE.txt