Note: added after answer: Thanks.. Yeah I had tried the Flag.SEEN to true and saveChanges.. I also had read getContent marks it read. I tried using it in the for statement that
You may also consider having a public static int max_message_number
, and storing in it the message[i].getMessageNumber();
as soon as you read a message. Then before reading any message just check if the max_message_number < message[i].getmessageNumber()
. If true then don't print this message (as it has been already read)