Fixed: reminder mails are not sent when delivery_method is :async_smtp (#5058).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9367 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
cfb06a2607
commit
fde9c7315a
|
@ -372,6 +372,17 @@ class Mailer < ActionMailer::Base
|
||||||
ActionMailer::Base.perform_deliveries = was_enabled
|
ActionMailer::Base.perform_deliveries = was_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sends emails synchronously in the given block
|
||||||
|
def self.with_synched_deliveries(&block)
|
||||||
|
saved_method = ActionMailer::Base.delivery_method
|
||||||
|
if m = saved_method.to_s.match(%r{^async_(.+)$})
|
||||||
|
ActionMailer::Base.delivery_method = m[1].to_sym
|
||||||
|
end
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
ActionMailer::Base.delivery_method = saved_method
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def initialize_defaults(method_name)
|
def initialize_defaults(method_name)
|
||||||
super
|
super
|
||||||
|
|
|
@ -36,6 +36,8 @@ namespace :redmine do
|
||||||
options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
|
options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
|
||||||
options[:users] = (ENV['users'] || '').split(',').each(&:strip!)
|
options[:users] = (ENV['users'] || '').split(',').each(&:strip!)
|
||||||
|
|
||||||
|
Mailer.with_synched_deliveries do
|
||||||
Mailer.reminders(options)
|
Mailer.reminders(options)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue