Hey all,
I’m been struggling with an email attachment problem for a few weeks
now. I can’t seem to get image attachments in an email to work. I’d
receive the email fine, but the actual image in the attachment is broken
(the actual image data never gets sent).
I’ve tried a dozen different code snippets, none of which work with
images. I can however, send any other type of file and receive it
perfectly (such as txt files, etc…)
Any ideas what it could be?
A bit of my code:
Controller
def send_email
ClientNotify.deliver_images_with_attachments
end
Mailer model
def images_with_attachments()
@subject = "test Subject
@body = {:body => “this is testing text”}
@recipients = “[email protected]”
@from = “[email protected]”
attachment :content_type => “image/jpg”, :filename => “TestImage.jpg”,
:body => File.read(RAILS_ROOT + “/public/images/TestImage.jpg”)
end