email_verifier 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  require 'net/smtp'
2
2
 
3
3
  class EmailVerifier::Checker
4
-
4
+
5
5
  ##
6
6
  # Returns server object for given email address or throws exception
7
7
  # Object returned isn't yet connected. It has internally a list of
@@ -16,6 +16,7 @@ class EmailVerifier::Checker
16
16
  # this is because some mail servers won't give any info unless
17
17
  # a real user asks for it:
18
18
  @user_email = EmailVerifier.config.verifier_email
19
+ _, @user_domain = @user_email.split "@"
19
20
  end
20
21
 
21
22
  def list_mxs(domain)
@@ -35,10 +36,10 @@ class EmailVerifier::Checker
35
36
  begin
36
37
  server = next_server
37
38
  raise EmailVerifier::OutOfMailServersException.new("Unable to connect to any one of mail servers for #{@email}") if server.nil?
38
- @smtp = Net::SMTP.start(server[:address], 25)
39
+ @smtp = Net::SMTP.start server[:address], 25, @user_domain
39
40
  return true
40
41
  rescue EmailVerifier::OutOfMailServersException => e
41
- return false
42
+ raise EmailVerifier::OutOfMailServersException, e.message
42
43
  rescue => e
43
44
  retry
44
45
  end
@@ -49,25 +50,10 @@ class EmailVerifier::Checker
49
50
  end
50
51
 
51
52
  def verify
52
- self.helo @user_email
53
53
  self.mailfrom @user_email
54
54
  self.rcptto(@email)
55
55
  end
56
56
 
57
- def helo(address)
58
- ensure_connected
59
-
60
- begin
61
- ensure_250 @smtp.helo(@domain)
62
- rescue Net::SMTPSyntaxError => e
63
- if e.message[/503/]
64
- # Looks like server already got HELO
65
- return true
66
- end
67
- raise Net::SMTPSyntaxError, e.message
68
- end
69
- end
70
-
71
57
  def mailfrom(address)
72
58
  ensure_connected
73
59
 
@@ -1,3 +1,3 @@
1
1
  module EmailVerifier
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-15 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  segments:
63
63
  - 0
64
- hash: 279839282407915089
64
+ hash: -590969574408865567
65
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  segments:
72
72
  - 0
73
- hash: 279839282407915089
73
+ hash: -590969574408865567
74
74
  requirements: []
75
75
  rubyforge_project:
76
76
  rubygems_version: 1.8.23