多个发件人进行Gmail IMAP搜索

时间:2012-11-02 12:48:20

标签: imap gmail-imap

此搜索查询似乎对我有效:

UID SEARCH OR ( OR ( OR (FROM "def@gmail.com") (FROM "abc@gmail.com")) (FROM "ghi@gmail.com")) (FROM "jkl@gmail.com")

但在尝试向Gmail IMAP查询该命令时出现“无法解析命令”错误。

我试过

  

UID搜索或“或来自”def@gmail.com“来自”abc@gmail.com“FROM   “ghi@gmail.com”来自“jkl@gmail.com”

  

UID SEARCH或(来自“jkl@gmail.com”)(或(来自“ghi@gmail.com”)(或   (来自“abc@gmail.com”)(来自“def@gmail.com”)))

  

UID搜索或者或者来自def@gmail.com来自abc@gmail.com FROM   ghi@gmail.com来自jkl@gmail.com

所有失败的“无法解析命令”。

1 个答案:

答案 0 :(得分:4)

首先,确保选择了邮箱,否则它将无效。其次,确保使用标记为命令添加前缀,否则IMAP会将您的UID命令解释为标记,并且实际上将执行SEARCH命令而不是UID命令。

最后,尝试慢慢构建搜索查询 。以下命令对我有用:

tag UID SEARCH FROM "def@gmail.com"
tag UID SEARCH OR FROM "def@gmail.com" FROM "abc@gmail.com"
tag UID SEARCH OR OR FROM "def@gmail.com" FROM "abc@gmail.com" FROM "blah@hotmail.com"
tag UID SEARCH OR OR OR FROM "def@gmail.com" FROM "abc@gmail.com" FROM "blah@hotmail.com" FROM "dah@bah.com"