mjs / imapclient

An easy-to-use, Pythonic and complete IMAP client library

Home Page:https://imapclient.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to search and fetch with some specific criteria?

arthurchen1906 opened this issue · comments

I follow the docs on https://imapclient.readthedocs.io/en/2.3.1/ to custom search and fetch but it doesn't turn out to be good.

for example,
i tried to search a certain email with

mclient.search(['TO', 'xxxx'])

but encountered with "InvalidCriteriaError"

and then I tried

mclient.search(['HEADER','TO','xxxx'])

no error, but the response is null

then, I tried to fetch the header information,

mclient.fetch(249, data= ['BODY[HEADER.FIELDS (to)]'])[249]

it worked with 'to' info returned

mclient.fetch(249, data= ['BODY[HEADER.FIELDS (X-FFF)]'])[249]

X-FFF is a customised header field, the response is null

Which server are you talking to? Your first attempt looks correct.

Closing due to inactivity. Please re-open if you can provide more detail.