我正在使用ruby-mail读取一封电子邮件。
除了邮件正文,我得到的所有内容都是正确可读的。
邮件正文显示为其他编码格式。
我的代码如下:
Mail.defaults do
retriever_method :pop3, :address => "some.email.com",
:port => 995,
:user_name => 'domain/username',
:password => 'pwd',
:enable_ssl => true
end
puts "From"
puts mail.from
puts "Sender:"
puts mail.sender
puts "To:"
puts mail.to
puts "CC:"
puts mail.cc
puts "Subject:"
puts mail.subject
puts "Date:"
puts mail.date.to_s
puts "MessageID:"
puts mail.message_id
puts "Body:"
#puts mail.body
输出结果为:
输出结果:
发件人: legalholdnotification123@emc.com
寄件人:
收件人: bhavesh.sharma@emc.com
抄送:
主题: case4: Legal Hold Notification
日期: 2012-04-24T14:46:25-04:00
消息ID: 3298720.1335293185423.JavaMail.root@vm-bhaveshok7
正文:
日期:2012年5月5日星期六09:45:08 -0700 Mime版本:1.0 内容类型:纯文本; 字符集=utf-8 内容传输编码:base64 内容ID:<4fa559147a120_138455aab4289ac@USITHEBBASL2C.mail>
Hello Sir/Madam,
We have identified you as a person who specifically wants to maintain the integrity of documents - with incidents involving personal and electronic documents - that are related to this matter and stored in the management domain. Please carefully review this memorandum document related to preserving evidence policies and guidelines, to ensure that the mandatory document retention policy is followed. [Company] should carefully review this memorandum document related to preserving evidence policies and guidelines, outlining the process for preserving electronic documents. Please contact us immediately if you have any questions or concerns about this matter. [Company] could be subject to legal action if it fails to comply with the mandatory document retention policy and other applicable document retention policies.
Thank you.
我无法阅读邮件正文。
需要做什么才能阅读邮件,我需要从正文中提取文本,并使用邮件正文中存在的链接。
Bhavesh