I have been using java mail to automate Gmail operations.
One of the operation is to delete mail and I use following for it –
message.setFlag(Flags.Flag.DELETED, true);
but doing so only pushes my mails to spam folder.
I am wondering if there is a straight way to delete mail permanently instead of deleting mail from “inbox” first and then searching mails in “spam ” folder and deleting them.
According to http://mail.google.com/support/bin/answer.py?answer=78755:
However, that page doesn’t give any indication that your approach would move mail to the spam folder; and it implies that you should see a folder named
[Gmail]/Spam; so maybe it doesn’t apply to your situation, somehow? I think you’ll just have to try its approach, and see whether it works for you!