Is it possible to set custom flags on IMAP mail messages using java mail without overwriting existing flags? Eg, I need to set a flag "processed" on processed messages without changing its state to SEEN / DELETED or without mail clients interfering with this "processed" flag.
Then I need to find all mail that doesn't have the "processed" flag and process them after which they are also flagged as "processed".
Thanks!
Flags processedFlag = new Flags("processed");
folder.setFlags(msgs, processedFlag, true);
// or
msg.setFlags(processedFlag, true);
Not all IMAP servers will support these "user flags", but most will. To find messages without this flag:
Message[] msgs = folder.search(new FlagTerm(processedFlag, false));
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