Inline attachment

Charanya Nagarajan
Mon, 25 Jan 2010 08:43:36 -0000

Hi All

I followed this link http://blog.thoughtobject.com/2007/05/26/5/ and
installed inline-attachment for attaching image files in my mails.

But when i add this
@cid = Time.now.to_f.to_s +
"lightbulb.png-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org"

inline_attachment :content_type => "image/png",
                  :body =>
File.read("#{RAILS_ROOT}/public/images/lightbulb.png"),
                  :filename => "lightbulb.png",
                  :cid => "<#{@cid}>"
in model emailer.rb
I get only this image in the mail
ie,even if i add some static content to html.erb as well as display some
of the dynamic data which i pass through,
recipients to_addr
    from "user-Tx5JXpX7d2+QWHG76I6BsA@public.gmane.org"
    subject    subj
    body       :cid => @cid, :message => msg, :name => to_name
    content_type "text/html"
and use

in the html.erb file,

I get only the image without any text.

But in case,I remove this inline_attachment part
inline_attachment :content_type => "image/png",
                  :body =>
File.read("#{RAILS_ROOT}/public/images/lightbulb.png"),
                  :filename => "lightbulb.png",
                  :cid => "<#{@cid}>"

and try without
in the html.erb file, the text are all coming .

I am not able to figure out whats wrong.Kindly help me in cracking this.

Thanks In Advance.
--
Posted via http://www.ruby-forum.com/.