image attachment in mail with rails3

30 views
Skip to first unread message

amruby

unread,
Jul 31, 2012, 6:29:18 AM7/31/12
to rubyonra...@googlegroups.com
yes this will send one mail with attachment of image.png. But when i open or download that image, that is empty.?


require 'open-uri'
class UserMailer < ActionMailer::Base
  default :from => "ma...@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
Reply all
Reply to author
Forward
0 new messages