Class: Notify::Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/notify/mailer.rb

Instance Method Summary collapse

Instance Method Details

#dispatch(message_name, locals:, to:, subject:, from: nil, cc: nil, bcc: nil, template_path: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/notify/mailer.rb', line 7

def dispatch(message_name, locals:, to:, subject:, from: nil, cc: nil, bcc: nil, template_path: nil)
  prepend_view_path(template_path.to_s) if template_path

  bridge_locals(locals)

  mail_options = {
    to: to,
    subject: subject,
    template_name: message_name.to_s,
    template_path: ""
  }
  mail_options[:from] = from if from
  mail_options[:cc] = cc if cc
  mail_options[:bcc] = bcc if bcc

  mail(mail_options)
end