Imap "search all" area: all folders / current folder?

I'm trying to find out if the IMAP search command works (using args: "unseen all" ) by looking at all the folders in the mailbox or only the currently selected folder?

those. when selecting INBOX and issuing the search command, it does not find any new messages.

  a select "INBOX"
 * 383 EXISTS
 * 0 RECENT
 [...]
 a search unseen all
 * SEARCH
 a OK Success

But when I go to the folder with the new message, it works:

  a select "inbox / test1 / test2"
 [...]
 a uid search unseen all
 * SEARCH 7 8 9

He discovers three new messages, which is true. So my question is: is this behavior right? Shouldn't search unseen all search all folders for new messages?

+6
source share
1 answer

According to RFC

The SEARCH command searches the mailbox for messages matching the given search criteria. Search criteria consist of one or more search keys. The unmarked SEARCH request from the server contains a list of message sequence numbers matching those messages that match the search criteria.

where the keyword ALL refers to

All messages in the mailbox ; default initial key for AND operation.

So, no, there seems to be no standard way to do what you are looking for (although there may be plugins for different IMAP servers that make this easier).

+5
source

Source: https://habr.com/ru/post/886125/


All Articles