![](/img/trans.png)
[英]Trying to retrieve emails using LIKE query with MailBox (imap_tools module)
[英]Search creteria for query in mailbox imap_tools library
我正在嘗試使用 python3 imap_tools在郵箱中查詢,無法理解如何使用發件人電子郵件和看不見的標志提取電子郵件。 像這樣嘗試
for msg in [msg for msg in mailbox.fetch(Q(from_=sender, seen=False))]
並且總是得到同樣的錯誤
imap_tools.utils.UnexpectedCommandStatusError: Response status for command "box.search" == "NO", "OK" expected, data: [b'[CANNOT] Unsupported search criterion: FROM "ZOYA1608@YANDEX.RU" UNSEEN']
有人可以解釋我的錯誤在哪里,下面的完整代碼
with open("..\\conf\\conf.yaml", mode="r") as stream:
for conf in yaml.safe_load_all(stream):
with MailBox(conf['host']).login(conf['mailbox'], conf['password']) as mailbox:
for sender in conf['senders']['from']:
for msg in [msg for msg in mailbox.fetch(Q(from_=sender, seen=False))]:
for att in msg.attachments:
with open(get_path(file_name=att.filename, store_paths=conf['store_paths']), 'w+b') as f:
f.write(att.payload)
最有可能的是:您的服務器不完全支持 IMAP 搜索規范。
問候, imap_tools 作者。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.