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
The easiest way to do that is set the folder to be read or written into or from. Means like this...
Folder inbox = null; inbox.open(Folder.READ_WRITE);
the Folder class should be imported.