Saboor wrote: > hi, > try this, it is working fine. > for inline attachment................................. > attachment :content_type => "application/html", > :filename => filename, > :body => File.read(filename) > > @cid='logo....@bizmail.yahoo.com' > image_path = "#{RAILS_ROOT}/public/images/logo.jpg" > f=File.open(image_path,'rb') > inline_attachment :content_type => "image/jpg", > :body => f.read, > :filename => "logo.jpg", > :cid => '<#...@cid}>' > body[:cid] = @cid > > for display image in email > try this > <img src="cid:#{@cid}" />
Hai , This is a code i have uses to send an email with inline and attachment . I have one .png file . I used above code to send an email . But i got an error index 91697 out of string error The code is a=ActionMailer::Base.smtp_settings = { :address => 'ip address', :port => 25 , :domain => 'domain name'} @cid = "lightbulb....@domain.com" from 'from address' recipients 'to address' subject 'testing Mail ' attachment :content_type => "image/png", :body => File.read("#{RAILS_ROOT}/public/images/rails.png"), :filename => "rails.png" image_path = "#{RAILS_ROOT}/public/images/rails.png" f=File.open(image_path,'rb') inline_attachment :content_type => "image/png", :body => f.read , :filename => "rails.png", :cid => "<#...@cid}>" body[:cid] = @cid . -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.