Inline attachment

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@domain.com"

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@userdomian.com"
    subject subj
    body :cid => @cid, :message => msg, :name => to_name
    content_type "text/html"
and use
<img src="cid:#{@cid}" />
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 <img src="cid:#{@cid}" />
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.

hi,
try this, it is working fine.
for inline attachment.................................
attachment :content_type => "application/html",
                   :filename => filename,
                  :body => File.read(filename)

    @cid='logo.jpg@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}" />

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.jpg@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.png@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 .