【发布时间】:2015-02-13 09:51:15
【问题描述】:
我必须用 Ruby 编写一个电子邮件导入器,我偶然发现了用于 Ruby 1.9 的非常漂亮的 Mail gem。我知道如何遍历未读消息,但我不知道如何将它们标记为已读(文档很详尽,但我真的不知道要注意什么):
Mail.defaults do
retriever_method :imap,
address: email_account.email_server.host,
port: email_account.email_server.port,
user_name: email_account.address,
password: email_account.password,
enable_ssl: email_account.email_server.ssl
end
emails = Mail.find(
what: :first,
count: 3,
order: :asc
)
emails.each do |email|
# Do some stuff and then mark as read!
end
非常感谢您为我指明了正确的方向。
【问题讨论】: