0
我創建一個郵件對象,像這樣:導軌 - 在數據庫中存儲一個ActionMail Mail.new對象
textpart_to_inject= params[:text]
htmlpart_to_inject= params[:html]
message_all = Mail.new do
to #{params[:to]}
from #{params[:from]}
subject #{params[:subject]}
text_part do
body textpart_to_inject
end
html_part do
content_type 'text/html; charset=UTF-8'
body htmlpart_to_inject
end
end
然後我要插入到數據庫中,像這樣:
@incoming_mail = IncomingMail.create(:message_all => Base64.encode64(message_all), :message_plain => Base64.encode64(params[:text]))
但與錯誤:是
TypeError (can't convert Mail::Message into String):
app/controllers/incoming_mails_controller.rb:56:in `create'
我的數據庫列如下: message_all = BYTEA message_plain =文字
想法?謝謝
所以,你試圖將整個郵件對象作爲字節存儲到數據庫中? – raidfive 2011-02-02 05:55:41