ar_mailer 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,9 +1,15 @@
1
- = 1.3.3
1
+ === 1.4.0
2
+
3
+ * 1.8.7 and 1.9 STARTTLS compatibility, now uses smtp_tls gem for STARTTLS on
4
+ 1.8.6
5
+ * Fix 1.9 warnings
6
+
7
+ === 1.3.3
2
8
 
3
9
  * Work around class_inheritable_accessor being the wrong thing for
4
10
  ActionMailer::ARMailer.
5
11
 
6
- = 1.3.2
12
+ === 1.3.2
7
13
 
8
14
  * Terminate SMTP connection on TimeoutError since Net::SMTP may be in a bogus
9
15
  state. Issue by Eric O'Connell.
@@ -12,14 +18,14 @@
12
18
  * Upgraded to modern Hoe
13
19
  * Updated configuration information for Rails > 2.0
14
20
 
15
- = 1.3.1
21
+ === 1.3.1
16
22
 
17
23
  * Fix bug #12530, gmail causes SSL errors. Submitted by Kyle Maxwell
18
24
  and Alex Ostleitner.
19
25
  * Try ActionMailer::Base::server_settings then ::smtp_settings. Fixes
20
26
  bug #12516. Submitted by Alex Ostleitner.
21
27
 
22
- = 1.3.0
28
+ === 1.3.0
23
29
 
24
30
  * New Features
25
31
  * Added automatic mail queue cleanup.
@@ -28,7 +34,7 @@
28
34
  * Bugs fixed
29
35
  * Authentication errors are now handled by retrying once.
30
36
 
31
- = 1.2.0
37
+ === 1.2.0
32
38
 
33
39
  * Bugs fixed
34
40
  * Handle SMTPServerBusy by backing off @delay seconds then re-queueing
@@ -41,7 +47,7 @@
41
47
  * Supports TLS now. Requested by Dave Thomas. smtp_tls.rb from Kyle
42
48
  Maxwell & etc.
43
49
 
44
- = 1.1.0
50
+ === 1.1.0
45
51
 
46
52
  * Features
47
53
  * Added --chdir to set rails directory
@@ -56,11 +62,11 @@
56
62
  * Messages are removed from the queue on 5xx errors
57
63
  * Added Net::SMTP.reset to avoid needing to recreate the connection
58
64
 
59
- = 1.0.1
65
+ === 1.0.1
60
66
 
61
67
  * Bugs fixed
62
68
  * From and to of email destination were swapped
63
69
 
64
- = 1.0.0
70
+ === 1.0.0
65
71
 
66
72
  * Birthday
@@ -6,8 +6,8 @@ Rakefile
6
6
  bin/ar_sendmail
7
7
  lib/action_mailer/ar_mailer.rb
8
8
  lib/action_mailer/ar_sendmail.rb
9
- lib/smtp_tls.rb
10
9
  share/ar_sendmail
11
10
  test/action_mailer.rb
11
+ test/active_support.rb
12
12
  test/test_armailer.rb
13
13
  test/test_arsendmail.rb
data/Rakefile CHANGED
@@ -1,12 +1,11 @@
1
1
  require 'hoe'
2
2
 
3
- $:.unshift 'lib'
4
- require 'action_mailer/ar_sendmail'
5
-
6
- Hoe.new 'ar_mailer', ActionMailer::ARSendmail::VERSION do |ar_mailer|
7
- ar_mailer.rubyforge_name = 'seattlerb'
8
- ar_mailer.developer 'Eric Hodel', 'drbrain@segment7.net'
9
- ar_mailer.testlib = :minitest
10
- ar_mailer.extra_dev_deps << ['minitest', '~> 1.3']
3
+ Hoe.plugin :seattlerb
4
+
5
+ Hoe.spec 'ar_mailer' do
6
+ self.rubyforge_name = 'seattlerb'
7
+ developer 'Eric Hodel', 'drbrain@segment7.net'
8
+
9
+ extra_dev_deps << ['minitest', '~> 1.3']
11
10
  end
12
11
 
@@ -1,7 +1,12 @@
1
1
  require 'optparse'
2
2
  require 'net/smtp'
3
- require 'smtp_tls'
4
3
  require 'rubygems'
4
+ require 'openssl'
5
+ begin
6
+ require 'smtp_tls'
7
+ rescue LoadError
8
+ # only for 1.8.6 versions
9
+ end
5
10
 
6
11
  class Object # :nodoc:
7
12
  unless respond_to? :path2class then
@@ -14,20 +19,16 @@ end
14
19
  ##
15
20
  # Hack in RSET
16
21
 
17
- module Net # :nodoc:
18
- class SMTP # :nodoc:
22
+ class Net::SMTP
19
23
 
20
- unless instance_methods.include? 'reset' then
21
- ##
22
- # Resets the SMTP connection.
24
+ ##
25
+ # Resets the SMTP connection.
23
26
 
24
- def reset
25
- getok 'RSET'
26
- end
27
+ def reset
28
+ getok 'RSET'
27
29
  end
28
30
 
29
- end
30
- end
31
+ end unless Net::SMTP.method_defined? :reset
31
32
 
32
33
  module ActionMailer; end # :nodoc:
33
34
 
@@ -36,9 +37,8 @@ module ActionMailer; end # :nodoc:
36
37
  # SMTP server configured in your application's config/environment.rb.
37
38
  # ar_sendmail does not work with sendmail delivery.
38
39
  #
39
- # ar_mailer can deliver to SMTP with TLS using smtp_tls.rb borrowed from Kyle
40
- # Maxwell's action_mailer_optional_tls plugin. Simply set the :tls option in
41
- # ActionMailer::Base's smtp_settings to true to enable TLS.
40
+ # ar_mailer can deliver to SMTP with TLS using the smtp_tls gem Set the :tls
41
+ # option in ActionMailer::Base's smtp_settings to true to enable TLS.
42
42
  #
43
43
  # See ar_sendmail -h for the full list of supported options.
44
44
  #
@@ -54,7 +54,7 @@ class ActionMailer::ARSendmail
54
54
  ##
55
55
  # The version of ActionMailer::ARSendmail you are running.
56
56
 
57
- VERSION = '1.3.3'
57
+ VERSION = '1.4.0'
58
58
 
59
59
  ##
60
60
  # Maximum number of times authentication will be consecutively retried
@@ -167,7 +167,8 @@ end
167
167
 
168
168
  puts "%10d %8d %s %s" % [email.id, size, created, email.from]
169
169
  if email.last_send_attempt > 0 then
170
- puts "Last send attempt: #{Time.at email.last_send_attempt}"
170
+ last_send_attempt = Time.at email.last_send_attempt
171
+ puts "Last send attempt: #{last_send_attempt.asctime}"
171
172
  end
172
173
  puts " #{email.to}"
173
174
  puts
@@ -191,7 +192,7 @@ end
191
192
  options[:RailsEnv] = ENV['RAILS_ENV']
192
193
  options[:TableName] = 'Email'
193
194
 
194
- opts = OptionParser.new do |opts|
195
+ op = OptionParser.new do |opts|
195
196
  opts.banner = "Usage: #{name} [options]"
196
197
  opts.separator ''
197
198
 
@@ -277,8 +278,8 @@ end
277
278
  "Name of table holding emails",
278
279
  "Used for both sendmail and",
279
280
  "migration creation",
280
- "Default: #{options[:TableName]}") do |name|
281
- options[:TableName] = name
281
+ "Default: #{options[:TableName]}") do |table_name|
282
+ options[:TableName] = table_name
282
283
  end
283
284
 
284
285
  opts.on("-v", "--[no-]verbose",
@@ -295,7 +296,7 @@ end
295
296
  opts.separator ''
296
297
  end
297
298
 
298
- opts.parse! args
299
+ op.parse! args
299
300
 
300
301
  return options if options.include? :Migrate or options.include? :Model
301
302
 
@@ -305,7 +306,7 @@ end
305
306
  begin
306
307
  require 'config/environment'
307
308
  rescue LoadError
308
- usage opts, <<-EOF
309
+ usage op, <<-EOF
309
310
  #{name} must be run from a Rails application's root to deliver email.
310
311
  #{Dir.pwd} does not appear to be a Rails application root.
311
312
  EOF
@@ -405,11 +406,14 @@ end
405
406
 
406
407
  def deliver(emails)
407
408
  user = smtp_settings[:user] || smtp_settings[:user_name]
408
- Net::SMTP.start smtp_settings[:address], smtp_settings[:port],
409
- smtp_settings[:domain], user,
410
- smtp_settings[:password],
411
- smtp_settings[:authentication],
412
- smtp_settings[:tls] do |smtp|
409
+ server = Net::SMTP.new smtp_settings[:address], smtp_settings[:port]
410
+ server.start smtp_settings[:domain], user, smtp_settings[:password],
411
+ smtp_settings[:authentication] do |smtp|
412
+ if smtp_settings[:tls] then
413
+ raise 'gem install smtp_tls for 1.8.6' unless
414
+ server.respond_to? :starttls
415
+ smtp.enable_starttls
416
+ end
413
417
  @failed_auth_count = 0
414
418
  until emails.empty? do
415
419
  email = emails.shift
@@ -1,5 +1,8 @@
1
1
  require 'net/smtp'
2
- require 'smtp_tls'
2
+ begin
3
+ require 'smtp_tls'
4
+ rescue LoadError
5
+ end
3
6
  require 'time'
4
7
 
5
8
  class Net::SMTP
@@ -17,14 +20,8 @@ class Net::SMTP
17
20
  attr_reader :deliveries
18
21
  attr_reader :send_message_block
19
22
  attr_accessor :reset_called
23
+ attr_accessor :start_block
20
24
 
21
- send :remove_method, :start
22
-
23
- end
24
-
25
- def self.start(*args)
26
- @start_block.call if @start_block
27
- yield new(nil)
28
25
  end
29
26
 
30
27
  def self.on_send_message(&block)
@@ -42,6 +39,13 @@ class Net::SMTP
42
39
  @reset_called = 0
43
40
  end
44
41
 
42
+ alias test_old_start start
43
+
44
+ def start(*args)
45
+ self.class.start_block.call if self.class.start_block
46
+ yield self
47
+ end
48
+
45
49
  alias test_old_reset reset if instance_methods.include? 'reset'
46
50
 
47
51
  def reset
File without changes
@@ -91,7 +91,7 @@ end
91
91
  recip@h1.example.com
92
92
 
93
93
  3 5 Thu Aug 10 11:19:51 nobody@example.com
94
- Last send attempt: Thu Aug 10 11:40:05 -0700 2006
94
+ Last send attempt: Thu Aug 10 11:40:05 2006
95
95
  recip@h2.example.com
96
96
 
97
97
  -- 0 Kbytes in 3 Requests.
@@ -608,7 +608,7 @@ Last send attempt: Thu Aug 10 11:40:05 -0700 2006
608
608
  { :mail => 'body2', :to => 'recip@h2.example.com', :from => nobody },
609
609
  ]
610
610
 
611
- emails = email_data.map do |email_data| Email.create email_data end
611
+ emails = email_data.map do |email| Email.create email end
612
612
 
613
613
  tried = Email.create :mail => 'body3', :to => 'recip@h3.example.com',
614
614
  :from => nobody
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -30,7 +30,7 @@ cert_chain:
30
30
  x52qPcexcYZR7w==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-06-01 00:00:00 -07:00
33
+ date: 2009-06-24 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.12.1
54
+ version: 2.3.0
55
55
  version:
56
56
  description: |-
57
57
  ar_mailer is a two-phase delivery agent for ActionMailer. Even delivering
@@ -78,9 +78,9 @@ files:
78
78
  - bin/ar_sendmail
79
79
  - lib/action_mailer/ar_mailer.rb
80
80
  - lib/action_mailer/ar_sendmail.rb
81
- - lib/smtp_tls.rb
82
81
  - share/ar_sendmail
83
82
  - test/action_mailer.rb
83
+ - test/active_support.rb
84
84
  - test/test_armailer.rb
85
85
  - test/test_arsendmail.rb
86
86
  has_rdoc: true
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements: []
109
109
 
110
110
  rubyforge_project: seattlerb
111
- rubygems_version: 1.3.4.2217
111
+ rubygems_version: 1.3.4
112
112
  signing_key:
113
113
  specification_version: 3
114
114
  summary: ar_mailer is a two-phase delivery agent for ActionMailer
metadata.gz.sig CHANGED
Binary file
@@ -1,105 +0,0 @@
1
- # Original code believed public domain from ruby-talk or ruby-core email.
2
- # Modifications by Kyle Maxwell <kyle@kylemaxwell.com> used under MIT license.
3
-
4
- require "openssl"
5
- require "net/smtp"
6
-
7
- # :stopdoc:
8
-
9
- class Net::SMTP
10
-
11
- class << self
12
- send :remove_method, :start
13
- end
14
-
15
- def self.start( address, port = nil,
16
- helo = 'localhost.localdomain',
17
- user = nil, secret = nil, authtype = nil, use_tls = false,
18
- &block) # :yield: smtp
19
- new(address, port).start(helo, user, secret, authtype, use_tls, &block)
20
- end
21
-
22
- alias tls_old_start start
23
-
24
- def start( helo = 'localhost.localdomain',
25
- user = nil, secret = nil, authtype = nil, use_tls = false ) # :yield: smtp
26
- start_method = use_tls ? :do_tls_start : :do_start
27
- if block_given?
28
- begin
29
- send start_method, helo, user, secret, authtype
30
- return yield(self)
31
- ensure
32
- do_finish
33
- end
34
- else
35
- send start_method, helo, user, secret, authtype
36
- return self
37
- end
38
- end
39
-
40
- private
41
-
42
- def do_tls_start(helodomain, user, secret, authtype)
43
- raise IOError, 'SMTP session already started' if @started
44
- check_auth_args user, secret, authtype if user or secret
45
-
46
- sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
47
- @socket = Net::InternetMessageIO.new(sock)
48
- @socket.read_timeout = 60 #@read_timeout
49
- @socket.debug_output = STDERR #@debug_output
50
-
51
- check_response(critical { recv_response() })
52
- do_helo(helodomain)
53
-
54
- raise 'openssl library not installed' unless defined?(OpenSSL)
55
- starttls
56
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
57
- ssl.sync_close = true
58
- ssl.connect
59
- @socket = Net::InternetMessageIO.new(ssl)
60
- @socket.read_timeout = 60 #@read_timeout
61
- @socket.debug_output = STDERR #@debug_output
62
- do_helo(helodomain)
63
-
64
- authenticate user, secret, authtype if user
65
- @started = true
66
- ensure
67
- unless @started
68
- # authentication failed, cancel connection.
69
- @socket.close if not @started and @socket and not @socket.closed?
70
- @socket = nil
71
- end
72
- end
73
-
74
- def do_helo(helodomain)
75
- begin
76
- if @esmtp
77
- ehlo helodomain
78
- else
79
- helo helodomain
80
- end
81
- rescue Net::ProtocolError
82
- if @esmtp
83
- @esmtp = false
84
- @error_occured = false
85
- retry
86
- end
87
- raise
88
- end
89
- end
90
-
91
- def starttls
92
- getok('STARTTLS')
93
- end
94
-
95
- alias tls_old_quit quit
96
-
97
- def quit
98
- begin
99
- getok('QUIT')
100
- rescue EOFError
101
- end
102
- end
103
-
104
- end unless Net::SMTP.private_method_defined? :do_tls_start or
105
- Net::SMTP.method_defined? :tls?