Class: MultiNotifier::Middlewares::Mail

Inherits:
MultiNotifier::Middleware show all
Defined in:
lib/multi_notifier/middlewares/mail.rb

Defined Under Namespace

Classes: DeliveryValidator, Mailer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MultiNotifier::Middleware

#notify!

Instance Attribute Details

#deliveryObject

Returns the value of attribute delivery.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def delivery
  @delivery
end

#fromObject

Returns the value of attribute from.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def from
  @from
end

#html_bodyObject

Returns the value of attribute html_body.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def html_body
  @html_body
end

#subjectObject

Returns the value of attribute subject.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def subject
  @subject
end

#text_bodyObject

Returns the value of attribute text_body.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def text_body
  @text_body
end

#toObject

Returns the value of attribute to.



15
16
17
# File 'lib/multi_notifier/middlewares/mail.rb', line 15

def to
  @to
end

Instance Method Details

#notifyObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/multi_notifier/middlewares/mail.rb', line 29

def notify
  Mailer.delivery_method = delivery[:method]
  Mailer.send("#{delivery[:method]}_settings=", delivery[:settings] || {})

  headers = {
    :from => from,
    :to => to,
    :subject => subject
  }

  mailer = Mailer.notificaiton(headers, text_body, html_body)
  mailer.deliver

  mailer
end