2

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

elector
  • 1,327
  • 4
  • 26
  • 43

1 Answers1

14

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

Javier Diaz
  • 1,791
  • 1
  • 17
  • 25