Store imapsStore = getStore(imapHost, imapPort, userName, userPass, getProperties(),debugMail);
Folder givenFolder = imapsStore.getFolder(sourceFolder);
givenFolder.open(Folder.READ_ONLY);
/* Get the messages which is unread in the Inbox */
Message messages[] = givenFolder.search(new FlagTerm(new Flags(Flags.Flag.RECENT), true));
/* Use a suitable FetchProfile */
FetchProfile fp = new FetchProfile();
// fp.add(FetchProfile.Item.ENVELOPE);
// fp.add(FetchProfile.Item.FLAGS);
givenFolder.fetch(messages, fp);
这不会从 GMail 返回新邮件。? 如何让它工作?它甚至工作吗?我知道还有用于将消息标记为已读/未读的 SEEN 标志,我正在寻找真正最近的消息而不是未读消息。