email_verifier 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Binary file
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ *~
19
+ *.swp
20
+ *.swo
data/README.md CHANGED
@@ -17,11 +17,22 @@ And then execute:
17
17
 
18
18
  Or install it yourself as:
19
19
 
20
- $ gem install verifier
20
+ $ gem install email_verifier
21
21
 
22
22
  ## Usage
23
23
 
24
- Just put this in your model e. g:
24
+ To get info about realness of given email address, email_verifier connects
25
+ with mail server that email's domain points to and pretends to send an email.
26
+
27
+ Some stmp servers will not allow you to do this if you will not present
28
+ yourself as some real user. So first thing you'd need to set up is to
29
+ put something like this either in initializer or in application.rb file:
30
+
31
+ EmailVerifier.config do |config|
32
+ config.verifier_email = "realname@realdomain.com"
33
+ end
34
+
35
+ Then just put this in your model e. g:
25
36
 
26
37
  validates_email_realness_of :email
27
38
 
@@ -32,6 +43,8 @@ Or - if you'd like to use it outside of your models:
32
43
  This method will return true or false, or - will throw exception
33
44
  with nicely detailed info about what's wrong.
34
45
 
46
+ **Still Rails 3+ only** but compatibility with anything in tghe pipeline.
47
+
35
48
  ## Credits
36
49
  ![End Point Corporation](http://www.endpoint.com/images/end_point.png)
37
50
 
@@ -16,4 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
+ gem.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
19
20
  end
@@ -8,7 +8,7 @@ class EmailVerifier::Checker
8
8
  # real mail servers got from MX dns lookup
9
9
  def initialize(address)
10
10
  @email = address
11
- @domain = address.split("@").last
11
+ _, @domain = address.split("@")
12
12
  @servers = list_mxs @domain
13
13
  raise EmailVerifier::NoMailServerException.new("No mail server for #{address}") if @servers.empty?
14
14
  @smtp = nil
@@ -19,6 +19,7 @@ class EmailVerifier::Checker
19
19
  end
20
20
 
21
21
  def list_mxs(domain)
22
+ return [] unless domain
22
23
  `host -t MX #{domain}`.scan(/(?<=by ).+/).map do |mx|
23
24
  res = mx.split(" ")
24
25
  next if res.last[0..-2].strip.empty?
@@ -1,3 +1,3 @@
1
1
  module EmailVerifier
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_verifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-12-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
14
30
  description: Helper utility checking if given email address exists or not
15
31
  email:
16
32
  - kamil@endpoint.com
@@ -25,10 +41,7 @@ files:
25
41
  - README.md
26
42
  - Rakefile
27
43
  - email_verifier.gemspec
28
- - lib/.verifier.rb.swp
29
44
  - lib/email_verifier.rb
30
- - lib/email_verifier/.server.rb.swp
31
- - lib/email_verifier/.validates_email_realness.rb.swp
32
45
  - lib/email_verifier/checker.rb
33
46
  - lib/email_verifier/config.rb
34
47
  - lib/email_verifier/exceptions.rb
@@ -49,7 +62,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
62
  version: '0'
50
63
  segments:
51
64
  - 0
52
- hash: -1110459712102920340
65
+ hash: 4285945759283300825
53
66
  required_rubygems_version: !ruby/object:Gem::Requirement
54
67
  none: false
55
68
  requirements:
@@ -58,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
71
  version: '0'
59
72
  segments:
60
73
  - 0
61
- hash: -1110459712102920340
74
+ hash: 4285945759283300825
62
75
  requirements: []
63
76
  rubyforge_project:
64
77
  rubygems_version: 1.8.23
Binary file