0 votes

I like to delete my sent mails in gamil. how can i do this

by

1 Answer

0 votes

If you want to permanently delete a message from a folder:

  1. Move it to the [Gmail]/Trash folder.
  2. Delete it from the [Gmail]/Trash folder.

Here's the sample that deletes emails from IMAP sent folder permanently:

using(Imap imap = new Imap())
{
imap.ConnectSSL("imap.gmail.com");
imap.UseBestLogin("pat@gmail.com", "password");


CommonFolders common = new CommonFolders(imap.GetFolders());
imap.Select(common.Sent);

// Find all emails we want to delete
List<long> uids = imap.Search(Expression.Subject("email to delete"));

// Move email to Trash
List<long> uidsInTrash = imap.MoveByUID(uids , common.Trash);

// Delete moved emails from Trash
imap.Select(common.Trash);
imap.DeleteMessageByUID(uidsInTrash);

imap.Close();
}

You can find more details here:
https://www.limilabs.com/blog/delete-email-permanently-in-gmail

by (301k points)
...