12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/mailers/maktoub/newsletter_mailer.rb', line 12
def publish(newsletter_name, params)
@name = params[:name]
@subject = newsletter_name.humanize.titleize
@email = params[:email]
@newsletter_name = newsletter_name
mail_fields = {
subject: @subject,
to: params[:email]
}
premailer = Premailer.new(render("maktoub/newsletters/#{newsletter_name}").to_s,
with_html_string: true,
link_query_string: CGI::escape("utm_source=newsletter&utm_medium=email&utm_campaign=#{@subject}")
)
mail(mail_fields) do |format|
format.text { premailer.to_plain_text.html_safe }
format.html { premailer.to_inline_css.html_safe }
end
end
|