Reputation: 2718
I implemented a simple pixel tracker for emails. When calling my controller method I use send_file
to respond with a gif image in an html email template.
send_file 'https://s3.eu-central-1.amazonaws.com/xxxxxxxxxxx.gif', :type => 'image/gif', :disposition => 'inline'
Now everytime the image is loaded I get
An ActionController::MissingFile occurred in emails#mail_check:
Cannot read file https://s3.eu-central-1.amazonaws.com/eventbaxx/xxxxxxxxxxx.gif app/controllers/emails_controller.rb:90:in `mail_check'
I realize that it might have to do with access rights but I set the file to public and I can also access the image via my browser so that should not be the problem.
My app is hosted on heroku.
What do I do wrong?
Upvotes: 0
Views: 418
Reputation: 32933
AFAIK you can't do send_file with a file which isn't on your server. You can copy the file to your server, and send it, or you can redirect to the file which is the more efficient option.
See Using send_file to download a file from Amazon S3?
Upvotes: 1