Ruby net::imap 为电子邮件添加颜色类别

问题描述

我每天都在使用 net::imap 阅读大量电子邮件 https://ruby-doc.org/stdlib-2.5.1/libdoc/net/imap/rdoc/Net/IMAP.html

我似乎找不到向消息添加彩色类别的方法

例如

imap.search(["ON","26-APR-2021"]).each do |message_id|
# my code...
# at the end of the code
  message_id.AddCatagory(blue)...
end

解决方法

在编写良好的 ruby​​ 中,方法名称将是 add_category。但这并不存在,因为颜色不是 IMAP 中的概念。标志确实存在,而且我知道有些客户使用颜色来表示标志……所以您可能正在寻找的代码类似于

imap.uid_store(uids,"+flags",[:Blue])

当然,您必须定义蓝色。或者重要的,标记的什么的。许多客户端使用标记来表示模糊的重要消息。