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.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rock-queue/notifiers/email_notifier.rb', line 9 def initialize(config) $server_config = config Mail.defaults do delivery_method :smtp, { :address => $server_config[:server], :port => $server_config[:port], :user_name => $server_config[:username], :password => $server_config[:password] } end end |
Instance Method Details
#update(error) ⇒ Object
Notify by email
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rock-queue/notifiers/email_notifier.rb', line 23 def update(error) RockQueue.logger.info "Sending e-mail message: #{error.}" Mail.deliver do from $server_config[:from] to $server_config[:to] subject "Processing error - '#{error.}'" body error.backtrace.join("\n") end end |