rubyonrailsin

A Ruby and Rails talk

Thursday, March 11, 2010


[Rails] Re: ActionMailer - attaching a PDF

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Hey, here's an example,

def mailer_method(mymodel)
content_type "multipart/alternative"
part :content_type => "text/html", :body => mymodel.text
attachment "application/pdf" do |a|
a.filename = mymodel.pdf_filename
a.body = mymodel.pdf_render.render
end

Take a look on the "content_type" header, you have to set the mail as a
Multipart email, not just html.

Regards,
Fernando
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive