具有多个OR的IMAP条件

编程入门 行业动态 更新时间:2024-10-26 16:27:34
本文介绍了具有多个OR的IMAP条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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条件

本文发布于:2023-11-22 00:50:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615325.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   条件   IMAP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!