2

Can some one help me on how to delete a message after reading it.

I am using Gmail-Imap.

I could read the mail, read the attachments, but have no clue on how to delete a message.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
RaviKiran
  • 585
  • 2
  • 7
  • 16

1 Answers1

3

Read this SO Post.

If you're using JavaMail, you should first move it to trash:

Folder trash = store.getFolder("[Gmail]/Bin");
for (Message m : msgs) {
    inbox.copyMessages(new Message[] { m }, trash);
}
Community
  • 1
  • 1
Synxmax
  • 2,226
  • 1
  • 22
  • 38
  • I have tried it by.. Its says Folder not found. On reading up on it ia have found that Draft, Spam and Trash are not folders but Labels in Google Mail. Is it true? Please help – RaviKiran Nov 20 '11 at 13:49
  • I just got the following in my log: javax.mail.FolderNotFoundException: [Gmail]/Bin does not exist – Howard Dec 11 '12 at 00:27