我正在尝试在我的 RoR 项目中显示电子邮件正文。
class IncomingMail
def initialize(message, params)
if person = Person.find_by_email(message.from)
changeMessage = Message.where({person_id: person.id})
#message = message.subject.force_encoding("UTF-8")
message = message.body.encoded
changeMessage.first.text = message
changeMessage.first.backInMinutes = 0
changeMessage.first.showText = 1
changeMessage.first.doNotDisturb = 0
changeMessage.first.save
end
end
但我也得到了电子邮件标题
> --e89a8ff1c0465030f204c082e054 Date: Mon, 21 May 2012 04:45:12 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit Content-ID:
> <4fb9ac38c71d2_1e1343dd8042105b@ubuntu.mail> Text of the mail
如何删除标题?
主题是这样的
message = message.subject.force_encoding("UTF-8")
但与身体无关。