Log email delivery errors.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3356 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-01-31 11:41:58 +00:00
parent a0364deb6a
commit df46d704e8
1 changed files with 15 additions and 1 deletions

View File

@ -284,7 +284,21 @@ class Mailer < ActionMailer::Base
if @references_objects
mail.references = @references_objects.collect {|o| self.class.message_id_for(o)}
end
super(mail)
# Log errors when raise_delivery_errors is set to false, Rails does not
raise_errors = self.class.raise_delivery_errors
self.class.raise_delivery_errors = true
begin
return super(mail)
rescue Exception => e
if raise_errors
raise e
elsif mylogger
mylogger.error "The following error occured while sending email notification: \"#{e.message}\". Check your configuration in config/email.yml."
end
ensure
self.class.raise_delivery_errors = raise_errors
end
end
# Sends reminders to issue assignees