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)
endalt.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)
endend 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?
“Action Mailer will automatically send multipart emails if you have different templates for the same action.”
For example having these files would give you text and html versions:
Check the Rails Guides for details: