imapfilter icon indicating copy to clipboard operation
imapfilter copied to clipboard

Can't search email in folder / label

Open VoidAndAny opened this issue 3 years ago • 1 comments

I don't how to "select"/search all messages of a user defined folder / tag / label (don't know the right term for Gmail), I thought it was:

messages = account1["Lecture"]
print(#messages)

But it print 0

I'me sure I have message in this folder because I moved one just before with imapfilter:

messages = account1.INBOX:contain_subject("test imapfilter")
messages:move_messages(account1["Lecture"])

Thanks

VoidAndAny avatar Dec 06 '22 20:12 VoidAndAny

The account1["Lecture"] is a mailbox object, not a collection of all messages of the mailbox. You need to send a search query for all messages, and you do that with select_all():

messages = account1["Lecture"]:select_all()
print(#messages)

lefcha avatar Jan 06 '23 09:01 lefcha