繁体   English   中英

尝试使用带有 MailBox 的 LIKE 查询检索电子邮件(imap_tools 模块)

[英]Trying to retrieve emails using LIKE query with MailBox (imap_tools module)

我想从我的 gmail 帐户中检索所有以“a”开头的“发件人”电子邮件。

这是我目前拥有的:

with MailBox('imap.gmail.com').login('blabla@gmail.com', 'blabla') as mailbox:
    froms = [msg.from_ for msg in mailbox.fetch()]

问题是我在引用 LIKE 查询的文档中找不到任何内容。 我试过这个:

froms = [msg.from_ for msg in mailbox.fetch(AND(from_="a%"))]

但它不起作用。

这是不可能的。

https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.4

FROM <string>
         Messages that contain the specified string in the envelope
         structure's FROM field.

暂无
暂无

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

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