Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Trouble sending emails with attachments with Rails 3.0.7
  2. attachments["example.png"] = File.read("path to image file")
  3.        
  4. attachments["rails.png"] = {:content=>File.read("#{Rails.root}/public/images/rails.png"),
  5.                             :mime_type=>"images/png"}
  6.        
  7. def pdf_email(email, subject, pdfname, pdfpath)
  8.   mail(:to => email, :subject => subject)
  9.   attachments[pdfname] = File.read(pdfpath)
  10. end
  11.        
  12. def pdf_email(email, subject, pdfname, pdfpath)
  13.   attachments[pdfname] = File.read(pdfpath)
  14.   mail(:to => email, :subject => subject)
  15. end