Class: Maktoub::NewsletterMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/maktoub/newsletter_mailer.rb

Instance Method Summary collapse

Instance Method Details

#publish(newsletter_name, params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/mailers/maktoub/newsletter_mailer.rb', line 10

def publish(newsletter_name, params)
  @name = params[:name]
  @subject = newsletter_name.humanize.titleize
  @email = params[:email]
  @newsletter_name = newsletter_name

  mail(
    subject: @subject,
    to: params[:email],
    with_html_string: true,
    link_query_string: "utm_source=newsletter&utm_medium=email&utm_campaign=#{CGI::escape(@subject)}",
    template_path: 'maktoub/newsletters',
    template_name: newsletter_name
  )
end