Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imap "search all" scope: all folders/current folder?

I'm trying to figure out if IMAP's search (with args: "unseen all") command works by searching all folders in a mailbox, or just the currently selected folder?

I.e. when selecting INBOX and issuing search command, it doesn't find any new messages.

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

But when I move into a folder which has a new message, it works:

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

It detects three new messages, which is the truth. So my question is, is this behavior correct? Shouldn't search unseen all search all folders for new messages?

like image 282
antonone Avatar asked Apr 18 '11 08:04

antonone


1 Answers

According to the RFC

The SEARCH command searches the mailbox for messages that match the given searching criteria. Searching criteria consist of one or more search keys. The untagged SEARCH response from the server contains a listing of message sequence numbers corresponding to those messages that match the searching criteria.

where the keyword ALL refers to

All messages in the mailbox; the default initial key for ANDing.

So, no, there does not appear to be a standard way to do what you're looking for (although there may well be plugins for various IMAP servers that facilitate that).

like image 84
davek Avatar answered Sep 23 '22 08:09

davek