Re: Inline attachment

Vetrivel Vaithilingam
Fri, 26 Mar 2010 11:34:21 -0000

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-72ZkFAYT80L8TXn3tpL0tAC/G2K4zDHf@public.gmane.org''
>     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
>

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-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org"
                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/.