Using remote file as attachment in rails
I'm trying to pull a public AWS file and use it as an attachment, like so:
attachments['file.zip'] = open('https://s3.amazonaws.com/file.zip')
I'm getting a No 开发者_Python百科such file or directory
I've changed the paths above to be generic, but I can indeed navigate to the AWS path and get a file. Is there a way to make it an attachement for use by ActionMailer?
attachments['file.zip'] = open('https://s3.amazonaws.com/file.zip').read
open
returns an IO object, not the content of the file. You must give the file content to attachments
.
精彩评论