public static void Run()
{
//ExStart:DeleteSingleMessage
using (ImapClient client = new ImapClient("exchange.aspose.com", "username", "password"))
{
try
{
Console.WriteLine(client.UidPlusSupported.ToString());
// Append some test messages
client.SelectFolder(ImapFolderInfo.InBox);
MailMessage message = new MailMessage("[email protected]", "[email protected]", "EMAILNET-35227 - " + Guid.NewGuid(), "EMAILNET-35227 Add ability in ImapClient to delete message");
string emailId = client.AppendMessage(message);
// Now verify that all the messages have been appended to the mailbox
ImapMessageInfoCollection messageInfoCol = null;
messageInfoCol = client.ListMessages();
Console.WriteLine(messageInfoCol.Count);
// Select the inbox folder and Delete message
client.SelectFolder(ImapFolderInfo.InBox);
client.DeleteMessage(emailId);
client.CommitDeletes();
}
finally
{
}
}
//ExEnd:DeleteSingleMessage
}
}