aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notifiers/email.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
commit495c44445642cfae8f23fadde299ad5307f5be58 (patch)
tree0104c9eef164235aa5ab05b126c8f63e52fb8624 /lib/mauve/notifiers/email.rb
parent0c88fcc91db1b003cd5d5311f62700c7867b4099 (diff)
Big commit
--HG-- rename : views/please_authenticate.haml => views/login.haml
Diffstat (limited to 'lib/mauve/notifiers/email.rb')
-rw-r--r--lib/mauve/notifiers/email.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/mauve/notifiers/email.rb b/lib/mauve/notifiers/email.rb
index 2c14a54..f3b9a0f 100644
--- a/lib/mauve/notifiers/email.rb
+++ b/lib/mauve/notifiers/email.rb
@@ -38,6 +38,11 @@ module Mauve
@suppressed_changed = nil
end
+ def logger
+ @logger ||= Log4r::Logger.new self.class.to_s.sub(/::Default$/,"")
+
+ end
+
def send_alert(destination, alert, all_alerts, conditions = nil)
message = prepare_message(destination, alert, all_alerts, conditions)
args = [@server, @port]
@@ -46,14 +51,11 @@ module Mauve
Net::SMTP.start(*args) do |smtp|
smtp.send_message(message, @from, destination)
end
- rescue Errno::ECONNREFUSED => e
- @logger = Log4r::Logger.new "mauve::email_send_alert"
- @logger.error("#{e.class}: #{e.message} raised. " +
- "args = #{args.inspect} "
- )
- raise e
- rescue => e
- raise e
+ true
+ rescue StandardError => ex
+ logger.error "SMTP failure: #{ex.to_s}"
+ logger.debug ex.backtrace.join("\n")
+ false
end
end
@@ -98,8 +100,8 @@ module Mauve
# FIXME: include alert.detail as multipart mime
##Thread.abort_on_exception = true
m.body += "\n" + '-'*10 + " This is the detail field " + '-'*44 + "\n\n"
- m.body += alert.get_details()
- m.body += alert.get_details_plain_text()
+ m.body += alert.detail.to_s
+#' m.body += alert.get_details_plain_text()
m.body += "\n" + '-'*80 + "\n\n"
if @suppressed_changed == true