summaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-14 10:36:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-14 10:36:19 +0000
commit0061a3f04afee7654b3cbb35505a6af3dfbb3b53 (patch)
tree744406b126f1cc873b5c3abac0f3a3c00c306062 /app/controllers/admin_controller.rb
parent7e755a53b8536caf0c792e0d83270a9aac1da893 (diff)
downloadredmine-0061a3f04afee7654b3cbb35505a6af3dfbb3b53.tar.gz
redmine-0061a3f04afee7654b3cbb35505a6af3dfbb3b53.zip
Added 'email sending test' functionality.
Go to Admin -> Mail notifications and click on 'Send a test email'. If an error occurs while sending the mail, the error message is displayed to the user. git-svn-id: http://redmine.rubyforge.org/svn/trunk@632 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 19efb28cc..95d3505c7 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -56,6 +56,20 @@ class AdminController < ApplicationController
end
end
+ def test_email
+ raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
+ # Force ActionMailer to raise delivery errors so we can catch it
+ ActionMailer::Base.raise_delivery_errors = true
+ begin
+ @test = Mailer.deliver_test(logged_in_user)
+ flash[:notice] = l(:notice_email_sent, logged_in_user.mail)
+ rescue Exception => e
+ flash[:error] = l(:notice_email_error, e.message)
+ end
+ ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
+ redirect_to :action => 'mail_options'
+ end
+
def info
@db_adapter_name = ActiveRecord::Base.connection.adapter_name
@flags = Hash.new