Re: querying message flags -- finding list of unread message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux