Forum: Ruby on Rails image attachment in mail with rails3

7498884689bc6ec3e328c0b32f508b40?d=identicon&s=25 amruby (Guest)
on 2012-07-31 12:30
(Received via mailing list)
yes this will send one mail with attachment of image.png. But when i
open
or download that image, that is empty.?


imageurl =
https://chart.googleapis.com/chart?chs=150x150&cht...
require 'open-uri'
class UserMailer < ActionMailer::Base
  default :from => "mail@example.com"

  def welcome_email(imageurl,mailid)

    attachments['QR.png'] = {:mime_type => 'image/png',
                                     :content =>
open(URI.parse(imageURL))}
    mail(:to => mailid,
    :subject => "Code",
    :body => "Code")
  end
end

Thanks
vishnu
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.