Class: Dolphin::Sender::Mail

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Util
Defined in:
lib/dolphin/sender.rb

Instance Method Summary collapse

Methods included from Util

#logger

Instance Method Details

#notify(notification_object) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dolphin/sender.rb', line 17

def notify(notification_object)
  time_now = DateTime.now.strftime('%a, %d %b %Y %H:%M:%S %z')
  send_params = {
    :from => notification_object.from,
    :to => notification_object.to,
    :subject => notification_object.subject,
    :body => notification_object.body,
    :date => time_now,
    :event_id => notification_object.event_id
  }

  unless notification_object.to.blank?
    send_params[:cc] = notification_object.cc
  end

  unless notification_object.bcc.blank?
    send_params[:bcc] = notification_object.bcc
  end

  logger :info, send_params
  begin
    Mailer.notify(send_params)
    logger :info, "Success Sent message"
  rescue => e
    logger :error, e.message
  end

end