mail_box_validator 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3662097278f7804b3b30d8469ebab96c3826126
4
- data.tar.gz: e1d4b4c60a1066d2a70a7d1f0dc585bb15765117
3
+ metadata.gz: 16ef41c641a4baa65c3b37a9d7c6174273600aa9
4
+ data.tar.gz: 73ab4b28811b02a8603dca50e256b1144890de43
5
5
  SHA512:
6
- metadata.gz: 97c5b2719c8d266117324739587afe145f366af1b4dcbc17787bfaea5e30b4eca038b2a85e17f39d7404e91316d43c5c00b6551753a4764b9e354db02a497e13
7
- data.tar.gz: b657ceb096350d2e65eaccc3b1d31811bb86cd5806d28dcc7f75ca0c1414254255ef8cd23fbd1e6adc413c09d966d3a0c97028a70522ca6a7b2e9658af13f15f
6
+ metadata.gz: 08fae9f324620d43bd5d4395652d37174fa25751279db7083176c4a5351493c9c6e33ef75c90ba41b6abed96d24d8d1f7473d8d384207f4fbbc7896198f5c469
7
+ data.tar.gz: bfff6e3eff7a4c9ee1ec3d741f3a6fab5b13b81b09a9af132f9bc3e09302dd27cb0182dc3794f109966882d60c2ed47d9dbedaa1db153caa9693e058a38b95c4
@@ -7,7 +7,13 @@ module MailBoxValidator
7
7
  def valid?(mail_address)
8
8
  domain = mail_address.slice(/@(.*)/, 1)
9
9
  mx = mail_exchanger_record_for(domain)
10
- mx.present? && mx.all?(&return_valid?(mail_address))
10
+ mx.present? && mx.any?(&return_valid?(mail_address))
11
+ end
12
+
13
+ def mail_exchanger_record_for(domain)
14
+ Resolv::DNS.open do |dns|
15
+ dns.getresources(domain, Resolv::DNS::Resource::IN::MX).map { |r| r.exchange.to_s }
16
+ end
11
17
  end
12
18
 
13
19
  private
@@ -26,17 +32,11 @@ module MailBoxValidator
26
32
  'Telnetmode' => true,
27
33
  'Prompt' => /\d{3}.*/n
28
34
  )
29
- telnet.cmd('helo hi')
35
+ telnet.cmd('helo #{mail_address}')
30
36
  telnet.cmd("mail from: <#{mail_address}>")
31
37
  telnet.cmd("rcpt to: <#{mail_address}>") { |c| response = c }
32
38
  telnet.close
33
39
  response
34
40
  end
35
-
36
- def mail_exchanger_record_for(domain)
37
- Resolv::DNS.open do |dns|
38
- dns.getresources(domain, Resolv::DNS::Resource::IN::MX).map { |r| r.exchange.to_s }
39
- end
40
- end
41
41
  end
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module MailBoxValidator
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_box_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bidu Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler