Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed: reminder mails are not sent when delivery_method is :async_smt…

…p (#5058).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9367 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information...
commit fde9c7315ac6667091e5e7f2260850896e9ae35a 1 parent cfb06a2
@jplang jplang authored
Showing with 15 additions and 2 deletions.
  1. +11 −0 app/models/mailer.rb
  2. +4 −2 lib/tasks/reminder.rake
View
11 app/models/mailer.rb
@@ -372,6 +372,17 @@ def self.with_deliveries(enabled = true, &block)
ActionMailer::Base.perform_deliveries = was_enabled
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
def initialize_defaults(method_name)
super
View
6 lib/tasks/reminder.rake
@@ -35,7 +35,9 @@ namespace :redmine do
options[:project] = ENV['project'] if ENV['project']
options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
options[:users] = (ENV['users'] || '').split(',').each(&:strip!)
-
- Mailer.reminders(options)
+
+ Mailer.with_synched_deliveries do
+ Mailer.reminders(options)
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.