Converting old Mailer to Rails 3 (multipart/mixed)
- by Oscar Del Ben
I'm having some difficulties converting this old mailer api to rails 3:
content_type "multipart/mixed"
part :content_type => "multipart/alternative" do |alt|
alt.part "text/plain" do |p|
p.body = render_message("summary_report.text.plain.erb",
:message =
message.gsub(/<.br./,"\n"),
:campaign=campaign,
:aggregate=aggregate,
:promo_messages=campaign.participating_promo_msgs)
end
alt.part "text/html" do |p|
p.body = render_message("summary_report.text.html.erb",
:message = message,
:campaign=campaign,
:aggregate=aggregate,:promo_messages=campaign.participating_promo_msgs)
end
end
if bounce_path
attachment :content_type => "text/csv",
:body=> File.read(bounce_path),
:filename => "rmo_bounced_emails.csv"
end
attachment :content_type => "application/pdf",
:body => File.read(report_path),
:filename=>"rmo_report.pdf"
In particular I don't understand how to differentiate the different multipart options. Any idea?