Class: RockQueue::EmailNotifier
- Inherits:
-
AbstractNotifier
- Object
- AbstractNotifier
- RockQueue::EmailNotifier
- Defined in:
- lib/rock-queue/notifiers/email_notifier.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ EmailNotifier
constructor
A new instance of EmailNotifier.
-
#update(error) ⇒ Object
Notify by email.
Constructor Details
#initialize(config) ⇒ EmailNotifier
Returns a new instance of EmailNotifier.
5 6 7 |
# File 'lib/rock-queue/notifiers/email_notifier.rb', line 5 def initialize(config) $server_config = config end |
Instance Method Details
#update(error) ⇒ Object
Notify by email
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rock-queue/notifiers/email_notifier.rb', line 10 def update(error) begin require 'mail' rescue RockQueue::Base.logger.error "You need `mail` gem to use the Email Notifier" end RockQueue::Base.logger.info "Sending e-mail message: #{error.}" Mail.defaults do smtp do host $server_config[:server] port $server_config[:port] user $server_config[:username] pass $server_config[:password] end end Mail.deliver do from $server_config[:from] to $server_config[:to] subject "Processing error - '#{error.}''" body error.backtrace.join("\n") end end |