Currently I am trying to set the seen flag on an IMAP email like this:
messages[EmailNumber].setFlag(Flag.SEEN, true);
messages[EmailNumber].saveChanges();
Where messages[] is an array of Message object populated by loading all the emails in a folder (which is set to have Read/Write access) and EmailNumber is a specific email in the array computed by the user's choice of an Email in a JTable that I am populating with the emails themselves.
However this keeps giving me this on the second line:
javax.mail.IllegalWriteException: IMAPMessage is read-only
Even though I populate the messages array (in a different function) like this:
folder.open(Folder.READ_WRITE);
messages = folder.getMessages();
What's going on here?
Remove the call to saveChanges, it's unnecessary here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With