@@ -372,6 +372,17 class Mailer < ActionMailer::Base | |||||
372 | ActionMailer::Base.perform_deliveries = was_enabled |
|
372 | ActionMailer::Base.perform_deliveries = was_enabled | |
373 | end |
|
373 | end | |
374 |
|
374 | |||
|
375 | # Sends emails synchronously in the given block | |||
|
376 | def self.with_synched_deliveries(&block) | |||
|
377 | saved_method = ActionMailer::Base.delivery_method | |||
|
378 | if m = saved_method.to_s.match(%r{^async_(.+)$}) | |||
|
379 | ActionMailer::Base.delivery_method = m[1].to_sym | |||
|
380 | end | |||
|
381 | yield | |||
|
382 | ensure | |||
|
383 | ActionMailer::Base.delivery_method = saved_method | |||
|
384 | end | |||
|
385 | ||||
375 | private |
|
386 | private | |
376 | def initialize_defaults(method_name) |
|
387 | def initialize_defaults(method_name) | |
377 | super |
|
388 | super |
@@ -35,7 +35,9 namespace :redmine do | |||||
35 | options[:project] = ENV['project'] if ENV['project'] |
|
35 | options[:project] = ENV['project'] if ENV['project'] | |
36 | options[:tracker] = ENV['tracker'].to_i if ENV['tracker'] |
|
36 | options[:tracker] = ENV['tracker'].to_i if ENV['tracker'] | |
37 | options[:users] = (ENV['users'] || '').split(',').each(&:strip!) |
|
37 | options[:users] = (ENV['users'] || '').split(',').each(&:strip!) | |
38 |
|
38 | |||
39 | Mailer.reminders(options) |
|
39 | Mailer.with_synched_deliveries do | |
|
40 | Mailer.reminders(options) | |||
|
41 | end | |||
40 | end |
|
42 | end | |
41 | end |
|
43 | end |
General Comments 0
You need to be logged in to leave comments.
Login now