You can generate pdf from html also and attach that to your mail using PDFKit
here are codes inside your controller
html=render_to_string(:partial=> "confirmation")
pdfkit_instance = PDFKit.new(html)
UserMailer.registration_confirmation(@user,pdfkit_instance.to_pdf).deliver
in your mailer class use the following
def registration_confirmation(user,pdf_file)
attachments["#{user.company_name}_#{Time.now.strftime("%m%d_%Y")}.pdf"] =pdf_file
mail(:to => "#{user.name} <#{user.email}>", :subject => "yoursubject "
end
For installing PDFKit you can go through the blog http://blog.andolasoft.com/2012/10/usage-of-pdfkit-with-rails-328-and-ruby.html