summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-31 11:41:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-31 11:41:58 +0000
commitdf46d704e882823c30bc5cf0f2b88da8db98b47f (patch)
tree66358cfeb317e9435496e8173342e5c924df0802
parenta0364deb6a11b261424b19e1d9788a9b7be1ee83 (diff)
downloadredmine-df46d704e882823c30bc5cf0f2b88da8db98b47f.tar.gz
redmine-df46d704e882823c30bc5cf0f2b88da8db98b47f.zip
Log email delivery errors.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3356 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/mailer.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index b16b6a1cf..00a390a02 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -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