I use java mail to automate Gmail operations. One of the operations is to delete the mail, and I use the following for it -
message.setFlag(Flags.Flag.DELETED, true);
but at the same time my letters are sent only to the spam folder.
I am wondering if there is a direct way to delete mail permanently, instead of first deleting mail from the Inbox, and then looking for letters in the Spam folder and deleting them.
Tarun source share