Class: Outpost::Notifiers::Email
- Inherits:
-
Object
- Object
- Outpost::Notifiers::Email
- Defined in:
- lib/outpost/notifiers/email.rb
Overview
The Email notifier issues Outpost notifications to through email. It uses the ‘mail’ gem send the emails. You can see mail’s documentation in order to change how emails will be delivered: github.com/mikel/mail
This requires the ‘mail’ gem to be installed.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Email
constructor
A new instance of Email.
-
#notify(outpost) ⇒ Object
Issues a notification through email.
Constructor Details
#initialize(options = {}) ⇒ Email
Returns a new instance of Email.
22 23 24 25 26 27 28 29 30 |
# File 'lib/outpost/notifiers/email.rb', line 22 def initialize(={}) @from = [:from] @to = [:to] @subject = [:subject] || 'Outpost notification' unless @from && @to raise ArgumentError, 'You need to set :from and :to to send emails.' end end |
Instance Method Details
#notify(outpost) ⇒ Object
Issues a notification through email. This is a callback, called by an Outpost instance.
37 38 39 40 41 42 43 44 45 |
# File 'lib/outpost/notifiers/email.rb', line 37 def notify(outpost) mail = Mail.new mail.from = @from mail.to = @to mail.subject = @subject mail.body = (outpost) mail.deliver end |