Hello,

I'm attempting to generate emails with inline attachments.  I'm using
Action Mailer 4.1.6 and the attachment.inline method, but for some
reason all of my attachments are coming through as regular downloadable
attachments, not as inline attachments.  Here's the relevant code:

In emails_mailer.rb:

def send_email(email)
    attachments.inline['receipt.jpg'] = {:data =>
File.read("public/items/receipt.jpg").force_encoding("BINARY"),
:mime_type => "image/jpg"}
    mail(to: email.recipient, subject: "Email sent on #{Date.today}",
body: email.body)
end

In send_email.html.erb:

<%= image_tag attachments['receipt.jpg'].url %>

I've tried the solutions found here:

http://stackoverflow.com/questions/8356924/rails-attachments-inline-are-not-shown-correctly-in-gmail
http://stackoverflow.com/questions/16564366/rails-inline-mail-attachments-not-working-properly?lq=1
http://www.rubydoc.info/docs/rails/4.1.7/ActionMailer/Base

Still, the email always comes through as a downloadable image.  I'm
using Rails 4.1.6.

Any advice or pointers in the right direction?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/878a7fb3d875e58e9ddf8fc3ab240f69%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to