summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
commit0c78056a69cc3bee7fb1cd3261046995db55bfdf (patch)
tree67883c68edad43b2e6f96e9ea8b864370a6b207c /lib
parent5533eeff239e024539f3ddd5b2ffe3528144beef (diff)
downloadredmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.tar.gz
redmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.zip
Send emails asynchronously (#26791).
Custom async_* delivery methods are removed in favor of ActiveJob (Async by default). git-svn-id: http://svn.redmine.org/redmine/trunk@17588 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/configuration.rb7
-rw-r--r--lib/redmine/info.rb4
-rw-r--r--lib/tasks/email.rake5
3 files changed, 11 insertions, 5 deletions
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index c9a9b6b8c..6ca65304c 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -53,6 +53,13 @@ module Redmine
if @config['email_delivery']
ActionMailer::Base.perform_deliveries = true
@config['email_delivery'].each do |k, v|
+ # Comprehensive error message for those who used async_smtp and async_sendmail
+ # delivery methods that are removed in Redmine 4.0.
+ if k == 'delivery_method' && v.to_s =~ /\Aasync_(.+)/
+ $stderr.puts "Redmine now uses ActiveJob to send emails asynchronously and the :#{v} delivery method is no longer available.\n" +
+ "Please update your config/configuration.yml to use :#$1 delivery method instead."
+ exit 1
+ end
v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
ActionMailer::Base.send("#{k}=", v)
end
diff --git a/lib/redmine/info.rb b/lib/redmine/info.rb
index f7926a7aa..62452e277 100644
--- a/lib/redmine/info.rb
+++ b/lib/redmine/info.rb
@@ -13,7 +13,9 @@ module Redmine
["Ruby version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"],
["Rails version", Rails::VERSION::STRING],
["Environment", Rails.env],
- ["Database adapter", ActiveRecord::Base.connection.adapter_name]
+ ["Database adapter", ActiveRecord::Base.connection.adapter_name],
+ ["Mailer queue", ActionMailer::DeliveryJob.queue_adapter.class.name],
+ ["Mailer delivery", ActionMailer::Base.delivery_method]
].map {|info| " %-30s %s" % info}.join("\n") + "\n"
s << "SCM:\n"
diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake
index 374232f65..25d7d667b 100644
--- a/lib/tasks/email.rake
+++ b/lib/tasks/email.rake
@@ -161,11 +161,8 @@ END_DESC
user = User.find_by_login(args[:login])
abort l(:notice_email_error, "User #{args[:login]} not found") unless user && user.logged?
- ActionMailer::Base.raise_delivery_errors = true
begin
- Mailer.with_synched_deliveries do
- Mailer.test_email(user).deliver
- end
+ Mailer.deliver_test_email(user)
puts l(:notice_email_sent, user.mail)
rescue Exception => e
abort l(:notice_email_error, e.message)