开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜