Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

To get unread messages in any folder "exactly once"

843834Sep 7 2009
What am trying to do?

a. Poll the mail server(might be MS or gmail or yahoo..) (say now).
b. Get unread messages from a mailbox folder via IMAP. (via +'SEEN'+ flag)
c. Process the unread messages i.e. in my case i will send SMS to users according to filters specified.
d. Sleep and Poll the mail server after 10 min(say)
e. Now the question is how to do i get the next set of unread messages i.e. the unread messages other than those that i got in step (b)

Rules-
a. Note that i can't set the message as '+READ+' or '+SEEN+' as mine is not the standard client.
b. I think i can get hold of the largest message UID in the first poll and save it and in the next poll try to retrieve only the unread
messages with UID greater than that i saved. +But is there any good and easy approach to do the above+?
c. Also to be clear, in the interim period between two polls, if the user really reads a mail via his/her client, then in the next poll i am not interested in those read mails. So the question arises only if the user doesn't check any mail where my application really comes into picture

Please assist. Ping me if am unclear.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2009
Added on Sep 7 2009
0 comments
89 views