Forum: Ruby on Rails image attachment in mail with rails3

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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
This topic is locked and can not be replied to.