imap "search all" scope: all folders/current folder?
Asked Answered
H

1

8

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?

Haggi answered 18/4, 2011 at 8:46 Comment(0)
S
7

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).

Spam answered 18/4, 2011 at 8:51 Comment(1)
After realizing that RFC uses "mailbox" word when addressing a folder/directory, it became more clear that it is indeed a correct behavior ;). Thanks.Haggi

© 2022 - 2024 — McMap. All rights reserved.