Posted: January 03, 2014 13:23 by tneff
I wrote an own imap email client by using javamail.
I fetch each minute for new messages or message flag updates on the current selected folder.
This works fine expected for gmail accounts. I only get the "real flags" of a message the first time I'm fetching on the ImapFolder.
This means if a message is unread when I fetch the first time, I never get a flag-update when I mark the message as read by using the gmail web client.
If the user doesn't select another folder I do not close the ImapFolder. This means I use the same folder instance
and connection each time I fetch for new messages. If I use a new folder instance it would work with gmail accounts as well.
No my question, is this a known gmail behaviour (It's not listed here: https://support.google.com/mail/answer/78761?hl=en).
Or do I wrong by caching the ImapFolder instances?
Would it be the right way to create and open an ImapFolder each time before fetching and close it at the end?
The idea why I cache the folder instances is to get performance improvements.
I create the FetchProfile like this:
fetchProfile = new FetchProfile();
IMAPFolder#fetch(Message msgs, FetchProfile fp)
to get the messages.
I tested it with the latest javamail release 1.5.1.