Reputation: 2481
I connect to my email box vie POP3 and get unread messages count. There're 10 mails in the box with only 1 in unread state. But Folder.getUnreadMessagesCount() returns 10 instead of 1. Is this a problem within mail provider settings or I do something wrong?
Here's what I do:
Session session = Session.getDefaultInstance(props, new EMailAuthenticator(getLogin(), getPassword()));
Store store = session.getStore();
store.connect();
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
inbox.getUnreadMessageCount();
Upvotes: 1
Views: 637
Reputation: 108930
POP3 has no method to track read or unread messages (see RFC1939), so JavaMail will treat all messages as unread. If you want to be able to track read and unread e-mails, then you need to use IMAP.
Upvotes: 3