我正在寻找一种方法来搜索我的邮件服务器上的所有 IMAP 文件夹。我最近发现了IMAP ESEARCH 命令,它扩展了通常的 SEARCH 命令以跨文件夹搜索。然而,我似乎无法让它发挥作用。
我检查了邮件服务器是否支持ESEARCH
. 远程登录后,我执行了以下操作:
* OK JAMES IMAP4rev1 Server Server server-address is ready.
A1 LOGIN test test
A1 OK LOGIN completed.
A2 CAPABILITY
* CAPABILITY SASL-IR IDLE LITERAL+ AUTH=PLAIN CONDSTORE ESEARCH CHILDREN UIDPLUS UNSELECT WITHIN ENABLE I18NLEVEL=1 SEARCHRES IMAP4rev1 NAMESPACE QRESYNC
A2 OK CAPABILITY completed.
A3 LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "Drafts"
* LIST (\HasNoChildren) "." "Sent"
* LIST (\HasNoChildren) "." "Trash"
A3 OK LIST completed.
注意 的存在ESEARCH
。然后我尝试了以下ESEARCH
方法,但失败了。
A4 ESEARCH IN (mailboxes "INBOX") unseen
A4 BAD failed. Unknown command.
普通的搜索工作正常:
A5 SELECT INBOX
* FLAGS (\Answered \Deleted \Draft \Flagged \Seen)
...
A5 OK [READ-WRITE] SELECT completed.
A6 SEARCH UNSEEN
* SEARCH 3
A6 OK SEARCH completed.
从我可以阅读的规范和正式语法来看,这应该可以工作。任何帮助或指示将不胜感激。