简体   繁体   English

IMAP 搜索查询中有多少次重叠

[英]How many imbrication in an IMAP search query

I'm trying to make complex IMAP search query using bare python imaplib .我正在尝试使用裸 python imaplib进行复杂的 IMAP 搜索查询。

The query is pretty much simple I have a list of emails and I'm trying to query all messages with thoses adresses.查询非常简单,我有一个电子邮件列表,我正在尝试查询所有带有这些地址的邮件。

A simple query may look like this:一个简单的查询可能如下所示:

[
  ['OR',
    ['FROM', 'email1@domain.com'],
    ['OR',
      ['FROM', 'email2@domain.com'],
      ['FROM', 'email3@domain.com']
]]]

But when I began to make this kind of query with large set of addresses (more thant 5) I get:但是当我开始使用大量地址(超过 5 个)进行这种查询时,我得到:

SEARCH command error: BAD [b'Command Argument Error. 12']

Does the IMAP protocol have such limitation? IMAP 协议有这样的限制吗? Maybe because of the complexity of the query?也许是因为查询的复杂性? Or is the max imbrication layer?还是最大叠瓦层?

My references or:我的参考资料或:

IMAP Query limitations may be on your email server side. IMAP 查询限制可能在您的 email 服务器端。 This is independent of imaplib.这与 imaplib 无关。

You can try to use IMAP query builder from my lib: https://github.com/ikvk/imap_tools您可以尝试使用我的库中的 IMAP 查询生成器: https://github.com/ikvk/imap_tools

It can helps to build such queries much easier.它可以帮助更轻松地构建此类查询。

For example, i have successfully try to do this at (YANDEX, ZIMBRA, OUTLOOK, GOOGLE):例如,我已经成功地尝试在(YANDEX、ZIMBRA、OUTLOOK、GOOGLE)做到这一点:

from imap_tools import MailBox, OR
with MailBox('imap.mail.com').login('test@mail.com', 'pwd') as mailbox:
    for msg in mailbox.fetch(OR(from_=['1@a','2@a','3@a','4@a','5@a','6@a','hello@ya.ru'])):
        print(msg.date)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM