Class: UserNotifier::Mailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/user_notifier/mailer.rb

Instance Method Summary collapse

Instance Method Details

#notify(notification) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/mailers/user_notifier/mailer.rb', line 4

def notify(notification)
  @notification = notification
  old_locale = I18n.locale
  I18n.locale = @notification.locale
  subject = render_to_string(template: "user_notifier/mailer/#{@notification.template_name}_subject")
  m = mail({
    from: address_format(UserNotifier.system_email, @notification.from_name),
    reply_to: address_format(@notification.from_email, @notification.from_name),
    to: @notification.user.email,
    subject: subject,
    template_name: @notification.template_name
  })
  I18n.locale = old_locale
  m
end