IMAP协议搜索命令的搜索条件 [英] search criteria of IMAP protocol search command

查看:394
本文介绍了IMAP协议搜索命令的搜索条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从这里阅读:

http://docs.python.org/2/library/imaplib.html
IMAP4.search(charset, criterion[, ...])

imaplib具有

但是我不知道有什么标准可用,或者我可以为此输入任何内容吗?

But I don't understand what criterion are available, or is it that I can enter anything for it?

我搜索了该页面,但没有任何线索。

I searched that page,, but didn't get a clue.

推荐答案

我不确定Python对标准的期望如何,但我假设它与普通IMAP相同。请参考 SEARCH命令文档(如已经提出的建议),并使用关键字的组合,具体取决于您要检索的内容。条件示例:

I'm not sure how Python expects the criteria but I'm assuming it's the same as plain IMAP. Refer to the SEARCH command documentation (as larsks already suggested) and use a combination of keywords depending on what you want to retrieve. Examples of criteria:

SUBJECT Christmas

...检索主题行中包含圣诞节的邮件。

...retrieves messages containing "Christmas" in the subject line.

SUBJECT "New York"

...检索主题行中包含 New York(不带引号)的消息。

...retrieves messages containing "New York" (without quotes) in the subject line.

OR TO boss SUBJECT resignation

...将被读取为(向老板)或(主题辞职),并将检索在收件人字段中具有老板或主题行中包含辞职的消息。

...is to be read as (TO boss) OR (SUBJECT resignation) and will retrieve messages that either have "boss" in the "To" field or contain "resignation" in the subject line.

如上所示,IMAP搜索使用前缀符号在其标准中可能一开始会令人困惑。您可以使用方括号或通过以图形方式绘制标准树来对其进行推理-在嵌套 AND s或 OR s。

As you can see above, IMAP Search uses a prefix notation in its criteria that may at first be confusing. You can reason about them using brackets or else by graphically drawing a tree of criteria - especially useful when you get nested ANDs or ORs.

您可以使用大量不同的条件。有关整个列表,请参阅RFC。

There is a fair amount of different criteria you can use. Refer to the RFC for the whole list.

手动进行IMAP交互(例如使用telnet)可能会有所帮助,以便在花费之前习惯SEARCH请求的结构时间编码。

It may be helpful to interact with IMAP manually (e.g. using telnet) to get used to the structure of SEARCH requests before you spend time coding it.

这篇关于IMAP协议搜索命令的搜索条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆