Q: JavaMail get only new messages I was wondering if there was a way to get only new messages in javamail. For example, on an initial load, get all of the messages in the inbox, and store them. Then whenever the application loads again, only get the new messages instead of reloading them all again.
Is this possible with javamail, how does it work?
A bit of background, I'm trying to create a simple email client in android, and I have a test java project that successfully downloads all my emails.
Thanks!

A: You have to specify a FetchProfile that will give the criteria of messages you want to get from the server.
Below are examples of using it:
http://docs.oracle.com/javaee/7/api/javax/mail/FetchProfile.html
http://metoojava.wordpress.com/2010/03/21/java-code-to-receive-mail-using-javamailapi/

A: Use the Folder.search method with a FlagTerm that matches messages marked RECENT and/or not marked SEEN.
