Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ActionMailer Inline Image Attachment Issue

Reply
Thread Tools

ActionMailer Inline Image Attachment Issue

 
 
beanbrown@gmail.com
Guest
Posts: n/a
 
      02-10-2006
I have been wholely unsuccessful in having an inline image attachment
show in an HTML email. I have been able to create an email with plain,
html and image parts, but when attempting to set the content-id for an
image (so that I can refer back to it in the HTML), I am unable to get
it to appear using the headers attribute of the attachment.

Here is my code:
class Mailer < ActionMailer::Base

def email_html( user, to, subject, message )
@recipients = "(E-Mail Removed)"
@from = user.emailaddr
@subject = subject

part :content_type => "text/html",
:body => "<b>Welcome to <img src=\"cid:img1\" border=1>!</b>"

part "text/plain" do |p|
p.body = "this is plain"
p.transfer_encoding = "base64"
end

attachment :content_type => "image/gif",
:headers => {'content-id' => 'img1'},
:body => File.read("c:\temp\logo.gif"),
:filename => "logo"

# this works
self.parts[self.parts.length-1].filename = 'foo'

# this does not work
self.parts[self.parts.length-1].headers['content-id'] = 'bar'

end

end

# Please help!
# Eric

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActionMailer PDF attachment and Windows dkmd_nielsen Ruby 1 12-15-2009 02:03 AM
Ruby Email handling / TMail / ActionMailer chrisjroos@gmail.com Ruby 1 02-19-2009 04:48 AM
Simple mail send ... CGI or ActionMailer ? John N. Alegre Ruby 7 02-23-2006 12:52 AM
ActionMailer Kevin Brown Ruby 2 11-20-2005 08:33 AM
ActionMailer NoMethodError 'deliver' enspired Ruby 3 07-28-2005 03:18 PM



Advertisments