ikvk / imap_tools

Work with email by IMAP
Apache License 2.0
717 stars 83 forks source link

uid keyword criteria doesn't work #225

Closed jairuigou closed 10 months ago

jairuigou commented 10 months ago

I have tied the keyword_criteria example:

mailbox.fetch(A(uid=uids))

but its result is same as mailbox.fetch().It appears that it doesn't filter based on the uids list and still returns all of my emails.

python version i used: 3.11.6 imap_tools version: 1.5.0

ikvk commented 10 months ago

check uids type I have checked it and all works.

for msg in mailbox.fetch(A(uid=['360'])):
    print(msg.date, msg.uid)
ikvk commented 10 months ago

If it is still not works - write your email server name

jairuigou commented 10 months ago

If it is still not works - write your email server name

Thanks for the reply! I found that A(uid=['360']) returns "(UID 360)". But "(UID 360)" dosen't work withimaplib.IMAP4.client.uid(commands....) in my environment. And if I use "UID 360" without brackets like this:

for msg in mailbox.fetch("UID 360", limit=2):
    print(msg.date, msg.uid)

It works fine. I am not very familiar with the usage of imaplib, and it seems that the UID criteria wrapped in parentheses does not work for me. My email server name is: "imap.exmail.qq.com"

ikvk commented 10 months ago

Thanks, @jarugu I hope your experience will useful for people. What is you mail server?

ikvk commented 10 months ago

from @Jarugu: imap.exmail.qq.com