summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-21 03:04:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-03-21 03:04:43 +0000
commitddcad64aa28ebc4d5369815923fb6b99484c134f (patch)
treea3027112d3a83e78a8e9c4c5b2d4e58eb2f5ed12 /app/models/mail_handler.rb
parent429210f03ff072b84c633a5f9ec04fd2c8b8c24c (diff)
downloadredmine-ddcad64aa28ebc4d5369815923fb6b99484c134f.tar.gz
redmine-ddcad64aa28ebc4d5369815923fb6b99484c134f.zip
Don't abort processing of emails when an email triggers a parsing exception (#16122).
git-svn-id: http://svn.redmine.org/redmine/trunk@12995 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index da2c5c4e5..e2dba0e41 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -46,6 +46,14 @@ class MailHandler < ActionMailer::Base
super(email)
end
+ # Receives an email and rescues any exception
+ def self.safe_receive(*args)
+ receive(*args)
+ rescue => e
+ logger.error "An unexpected error occurred when receiving email: #{e.message}" if logger
+ return false
+ end
+
# Extracts MailHandler options from environment variables
# Use when receiving emails with rake tasks
def self.extract_options_from_env(env)