我想在电子邮件中提供跟踪图像。
该邮件将调用一条新浪路线,该路线将返回图像。
在rails中,我会这样做:
send_data Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="), type: "image/gif", disposition: "inline"
我在辛纳特拉怎么做?
get '/route' do content_type 'image/gif' Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==") end
如果要设置处置,可以这样做(例如):
headers 'Content-Disposition' => 'inline;filename="tracking.gif"'
或
attachment 'tracking.gif', 'inline'