OT, question on IMAP

Rob Siemborski rjs3 at andrew.cmu.edu
Thu Sep 11 12:38:42 EDT 2003


On Thu, 11 Sep 2003, Etienne Goyer wrote:

> Sorry for this OT message.  I have a question about IMAP-the-protocol,
> and I guessed tis is where I had the better chance of a good answer.

You can also try the IMAP protocol list itself (see www.imap.org).

> It's very simple actually.  From a program I am writing, I want to know
> how many messages in a mailbox are read or not.  I guess I must must
> somehow query for the \Seen flag.  While I am at it, why not make it
> generic and query how many messages in a mailbox have a particuliar flag
> set.
>
> So my question is : what would an IMAP client send to determine how many
> message in a particuliar mailbox have a particuliar flag setted ?  Is it
> possible to reverse this and ask how many messages *don't* have a
> particuliar flag setted ?

If you just need a count, you can issue the status command:

x status INBOX (UNSEEN)
* STATUS INBOX (UNSEEN 204)
x OK Completed

If you want the messages themselves, use search:

z select INBOX
y search UNSEEN
* SEARCH 1022 1355 1410 1484 1534 1579 1652 1737 1738 1753 1759 1787 1805
....
4038 4039 4042 4051 4054 4058 4060 4066 4069 4088 4097
y OK Completed (204 msgs in 0.000 secs)

-Rob

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rob Siemborski * Andrew Systems Group * Cyert Hall 207 * 412-268-7456
Research Systems Programmer * /usr/contributed Gatekeeper





More information about the Info-cyrus mailing list