[英]Trying to retrieve emails using LIKE query with MailBox (imap_tools module)
I would like to retrieve all "from" emails that begin with an "a" from my gmail account.我想从我的 gmail 帐户中检索所有以“a”开头的“发件人”电子邮件。
Here is what I currently have:这是我目前拥有的:
with MailBox('imap.gmail.com').login('blabla@gmail.com', 'blabla') as mailbox:
froms = [msg.from_ for msg in mailbox.fetch()]
The problem is I can't find anything in documentation referring to a LIKE query.问题是我在引用 LIKE 查询的文档中找不到任何内容。 I tried this:我试过这个:
froms = [msg.from_ for msg in mailbox.fetch(AND(from_="a%"))]
but it doesn't work.但它不起作用。
This is impossible.这是不可能的。
https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.4 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.