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
<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.
--
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
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
<img src="cid:#{@cid}" />
--
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
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 > <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-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/. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.