diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
commit | e140af144e987ff7f6d767f2dc48b9cf685803fd (patch) | |
tree | 4a01971890865b4b3ca837d563bc673cbb787de8 /lib/mauve/notifiers/email.rb | |
parent | d28af4ec946c6aa4b645b73cef47d7e0c680bc0d (diff) |
Big commit
* Added manpages for all binaries
* Added log-reopening for mauvealert-server, and logrotate snippet
* mauveserver now adds a user on install, and runs as that user
* Big logging tidy-up
* Alert subjects are only overwritten by the source, when the subject in the databse is empty
* Removed various attr_writer methods that were being redifined
* Added a notes box to the acknowledge form, but this doesn't work yet
Diffstat (limited to 'lib/mauve/notifiers/email.rb')
-rw-r--r-- | lib/mauve/notifiers/email.rb | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/mauve/notifiers/email.rb b/lib/mauve/notifiers/email.rb index 129afec..77b10f1 100644 --- a/lib/mauve/notifiers/email.rb +++ b/lib/mauve/notifiers/email.rb @@ -7,17 +7,9 @@ module Mauve module Notifiers module Email - - class Default + class Default attr_reader :name - attr :server, true - attr :port, true - attr :username, true - attr :password, true - attr :login_method, true - attr :from, true - attr :subject_prefix, true - attr :email_suffix, true + attr_writer :server, :port, :password, :login_method, :from, :subject_prefix, :email_suffix def username=(username) @login_method ||= :plain @@ -47,20 +39,15 @@ module Mauve message = prepare_message(destination, alert, all_alerts, conditions) args = [@server, @port] args += [@username, @password, @login_method.to_sym] if @login_method - history = Mauve::History.new(:alert => alert, :type => :notification) begin Net::SMTP.start(*args) do |smtp| smtp.send_message(message, @from, destination) end - history.event = "Sent mail to #{destination}." - history.save true rescue StandardError => ex logger.error "SMTP failure: #{ex.to_s}" logger.debug ex.backtrace.join("\n") - history.event = "Failed to send mail to #{destination} due to #{ex.to_s}" - history.save false end end |