简体   繁体   中英

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.

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. 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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