I am attempting to write a Java class which will retrieve messages from GMail via POP3. So far, I have copied this code: http://www.java-tips.org/other-api-tips/javamail/connecting-gmail-using-pop3-connection-with-ssl-6.html
It does actually retrieve the messages, but I need to make it fetch only the unread messages. I have a GMail account I'm using for test purposes, with 3 messages: 1 read, 2 unread. The code correctly says there are 3 messages, but says there are 0 new messages.
When I add a line
folder.getUnreadMessageCount();
it returns 3. I would expect it to return 2, as one of the messages has been read (via Gamil web access)
What's going on? Is there any way I can retrieve only unread messages?