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.
hi,
try this, it is working fine.
for inline attachment.................................
attachment :content_type => "application/html",
:filename => filename,
:body => File.read(filename)
hi,
try this, it is working fine.
for inline attachment.................................
attachment :content_type => "application/html",
:filename => filename,
:body => File.read(filename)
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 '