我正在使用gmail的IMAP API搜索邮件.
I am using gmail's IMAP API to search for mails.
我使用或"条件搜索不同的关键字.如果我仅上一个级别,例如
I use the 'OR' criteria to search for different keywords. This works well if I go one level only, i.e. something like
'UID SEARCH OR (FROM "somebody@email") (TO "somebody@email")'但是,当我尝试像
条件或条件或条件或条件
criteria OR criteria OR criteria or criteria
翻译成(据我了解的语法)
which translates to (as far as I understand the syntax)
'UID SEARCH OR ( OR (FROM "somebodyelse@email") (TO "somebodyelse@email")) ( OR (FROM "somebody@email") (TO "somebody@email"))'为了清楚起见,我基本上希望所有从给定电子邮件列表中发送或发送给任何电子邮件列表的消息
to make it clear I basically want all messages that are either sent from or sent to ANY of a given list of emails
我从libray得到的错误是
The error I get from the libray is
[ 'A34', 'BAD', 'Could', 'not', 'parse', 'command' ]有什么建议吗?
推荐答案请勿使用括号.
IMAP使用不需要的波兰语表示法:
IMAP uses polish notation which does not need them:
UID SEARCH OR OR FROM one@mail TO one@mail OR FROM two@mail TO two@mail在某些情况下需要括号(因为IMAP AND运算符可以使用两个以上的操作数): www.limilabs/blog/imap-search-requires-parentheses
There are cases where parenthesis are needed (as IMAP AND operator can take more than 2 operands): www.limilabs/blog/imap-search-requires-parentheses
更多推荐
具有多个OR的IMAP条件
发布评论