tuktuk 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tuktuk/tuktuk.rb CHANGED
@@ -5,9 +5,10 @@ require 'logger'
5
5
  require 'tuktuk/package'
6
6
 
7
7
  DEFAULTS = {
8
- :retry_sleep => 10,
8
+ :retry_sleep => 10,
9
9
  :max_attempts => 3,
10
- :log_to => nil # $stdout
10
+ :verify_ssl => true,
11
+ :log_to => nil # $stdout,
11
12
  }
12
13
 
13
14
  module Tuktuk
@@ -18,7 +19,7 @@ module Tuktuk
18
19
  class << self
19
20
 
20
21
  def deliver(message, opts = {})
21
- options = opts
22
+ self.options = opts if opts.any?
22
23
  mail = Package.new(message)
23
24
  mail['X-Mailer'] = "Tuktuk SMTP v#{VERSION}"
24
25
  response = lookup_and_deliver(mail)
@@ -33,8 +34,8 @@ module Tuktuk
33
34
  end
34
35
 
35
36
  def dkim=(dkim_opts)
36
- Dkim::domain = dkim_opts[:domain]
37
- Dkim::selector = dkim_opts[:selector]
37
+ Dkim::domain = dkim_opts[:domain]
38
+ Dkim::selector = dkim_opts[:selector]
38
39
  Dkim::private_key = dkim_opts[:private_key]
39
40
  end
40
41
 
@@ -56,8 +57,8 @@ module Tuktuk
56
57
  email_address && email_address.to_s[/@([a-z0-9\._-]+)/i, 1]
57
58
  end
58
59
 
59
- def success(destination)
60
- logger.info("#{destination} - Successfully sent!")
60
+ def success(to)
61
+ logger.info("#{to} - Successfully sent!")
61
62
  end
62
63
 
63
64
  def error(mail, to, error, attempt = 1)
@@ -66,7 +67,7 @@ module Tuktuk
66
67
  sleep config[:retry_sleep]
67
68
  lookup_and_deliver(mail, attempt+1)
68
69
  else
69
- logger.error("#{to} - Unable to send after #{attempt} attempts: #{error.message} [#{error.class.name}]")
70
+ logger.error("#{to} - Couldn't send after #{attempt} attempts: #{error.message} [#{error.class.name}]")
70
71
  raise error
71
72
  end
72
73
  end
@@ -112,7 +113,8 @@ module Tuktuk
112
113
  helo_domain = Dkim::domain || config[:helo_domain] || get_domain(from)
113
114
 
114
115
  context = OpenSSL::SSL::SSLContext.new
115
- context.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER
116
+ context.verify_mode = config[:verify_ssl] ?
117
+ OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
116
118
 
117
119
  smtp = Net::SMTP.new(server, nil)
118
120
  smtp.enable_starttls_auto(context)
@@ -1,7 +1,7 @@
1
1
  module Tuktuk
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- PATCH = 0
4
+ PATCH = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuktuk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Tom\xC3\xA1s Pollak"