querying message flags -- finding list of unread message
Dan White
dwhite at olp.net
Thu Sep 18 15:30:27 EDT 2008
lartc wrote:
> hi all,
>
> is there a way to query a message store to find what message are unread
> in a user's inbox?
>
>
You can use IMAP search to find that out (e.g. with imtest). Remember
that by default, seen state is not shared between users, so you'll need
to authorize as the owner of the mailbox to see their seen state.
Assuming you want to view seen state for user abrown, you could do:
imtest -m GSSAPI imap.example.com -u abrown
...
Authenticated.
c select user/abrown
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen NonJunk)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen NonJunk
\*)]
* 6 EXISTS
* 0 RECENT
* OK [UNSEEN 1]
* OK [UIDVALIDITY 1188505352]
* OK [UIDNEXT 614]
* OK [NOMODSEQ] Sorry, modsequences have not been enabled on this mailbox
* OK [URLMECH INTERNAL]
c OK [READ-WRITE] Completed
c search seen
* SEARCH 3 5
c OK Completed (2 msgs in 0.000 secs)
c search not seen
* SEARCH 1 2 4 6
c OK Completed (4 msgs in 0.000 secs)
c fetch 1,2,4,6 (FLAGS BODY[HEADER.FIELDS (DATE FROM)])
* 1 FETCH (FLAGS (\Seen NonJunk) BODY[HEADER.FIELDS (DATE FROM)] {116}
Date: Mon, 19 May 2008 05:01:08 -0400 (EDT)
From: <cut>
)
* 2 FETCH (FLAGS (\Seen) BODY[HEADER.FIELDS (DATE FROM)] {88}
From: <cut>
Date: Mon, 19 May 2008 03:15:16 -0700
)
* 4 FETCH (FLAGS (\Seen NonJunk) BODY[HEADER.FIELDS (DATE FROM)] {132}
Date: Mon, 19 May 2008 11:04:09 -0400 (EDT)
From: <cut>
)
* 6 FETCH (FLAGS (\Seen NonJunk) BODY[HEADER.FIELDS (DATE FROM)] {116}
From: <cut>
Date: Tue, 20 May 2008 11:30:40 -0500
)
c OK Completed (0.000 sec)
Or you could do the same with an IMAP client of course.
- Dan
More information about the Info-cyrus
mailing list