Just use the uniqueId, that will stay the same all the time. Even if the mail is deleted, the server should return messages after that unique id. You do not need to use dates at all. Just remember which uniqueId was the last you read and pass it to the ImapMessageSet as shown in my answer above.