Seems simple enough but I haven't been able to get it to work. The files work fine from S3 on my web app, but when I email them out via ActionMailer as attachments, see the code below, the files are corrupt.
App Stack: rails 3, heroku, paperclip + s3 Here's the code: class UserMailer < ActionMailer::Base # Add Attachments if any if @comment.attachments.count > 0 @comment.attachments.each do |a| require 'open-uri' open("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}", "wb") do |file| file << open(a.authenticated_url()).read attachments[a.attachment_file_name] = File.read("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}") end end end mail( :to => "#{XXXX}", :reply_to => "XXXXX>", :subject => "XXXXXX" ) a.authenticated_url() just gives me a URL to s3 to get the file (of any type), I checked this, works fine. Something to do with the way I'm saving the tempfile must be breaking the ActionMailer Attachment. Any ideas? -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.