I am trying to remove/delete a message from a folder in Java mail (after I have copied it to another) here is my code:
Flags deleted = new Flags("DELETED");
folder.setFlags(messages, deleted, true);
folder.expunge();
The message is not affected. Can someone please show me the proper way to do this?
A: Yes. The JavaMail API implementation is completely free and open source and you can include it in your product. This release includes IMAP, POP3, and SMTP providers as well.
The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API is available as an optional package for use with the Java SE platform and is also included in the Java EE platform.
Flags deleted = new Flags(Flags.Flag.DELETED);
folder.setFlags(messages, deleted, true);
folder.expunge(); // or folder.close(true);
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