开发者

ActionMailer - Attaching a file via Open

In my user_mailer, I'm trying to add an attachment like follows:

tempfile = File.new("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}", "w")
tempfile << open(a.authenticated_url())
tempfile.puts
attachments[a.attachment_file_name] = File.read("#{Rails.root.to_s}/tmp/#{a.attachment_file开发者_StackOverflow社区_name}")

This method: a.authenticated_url() is getting a valid URL, confirmed that

there's not error message but the file's being attached are corrupt and of the wrong size.

How can I attach a file to AcionMailer thats from a URL?

thanks

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜