java.mail mark message as unread

5.5k Views Asked by At

I am building an automatic mail processor application and I am parsing the emails one by one. If parsing one of the messages fails I would like to mark that message as unread? How do I mark a message as unread please?

Thank you

1

There are 1 best solutions below

0
On BEST ANSWER

messageObject.setFlag(Flags.Flag.SEEN, false);

The first parameter is the Flag, the second one it's if you want to negate that flag, so a Seen with flase is UNSEEN.

PS: You need to use imap, you can't do this with pop3