Class: Gossiper::Mailer

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

Instance Method Summary collapse

Instance Method Details

#mail_for(notification) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gossiper/mailer.rb', line 4

def mail_for(notification)
  @notification = NotificationDecorator.new(notification)

  config = notification

  config.attachments.each do |filename, file|
    attachments[filename] = file
  end

  config.instance_variables.each do |name, value|
    instance_variable_set("@#{name}", value)
  end

  mail(
    from:     config.from,
    reply_to: config.reply_to,
    to:       config.to,
    cc:       config.cc,
    bcc:      config.bcc,
    subject: config.subject,
    template_name: config.template_name,
    template_path: config.template_path
  )
end