Messages not being deleted

Hi there,

I have a simple application to get emails from an internal email server, after reading/processing an email, I delete it by calling client.DeleteMessage(index); everything was working before, I recently upgraded to aspose.email 6.2.0.0, email messages no longer deleted. client.DeleteMessage(index) called without errors, but messages remain on the server, I get same message again and again. am I missing any new parameters here?

thx


Hi,

Thank you for writing to Aspose support team.

I have checked the scenario using following sample code and observed that all the mails are deleted from my test account using following sample code. You use client.CommitDeletes() function at the end to complete the operation. Please give it a try using latest library Aspose.Email for .NET 16.10.0 and share the feedback.

ImapClient client = new ImapClient(“imap.gmail.com”, 993, "user@gmail.com", “password”);

client.SecurityOptions = SecurityOptions.Auto;

//ImapClient client = GetImapClient();

ImapFolderInfo fi = client.GetFolderInfo(ImapFolderInfo.InBox);

client.SelectFolder("Inbox");

ImapMessageInfoCollection messageInfoCol = client.ListMessages();

foreach (ImapMessageInfo info in messageInfoCol)

{

client.DeleteMessage(info.SequenceNumber);

}

client.CommitDeletes();

Thanks for the reply, here is my code.

client = new Pop3Client(ServerName, Port, User, Password);
client.SecurityOptions = Aspose.Email.SecurityOptions.Auto;
… fetch and process emails …
try
client.DeleteMessage(index);
log success
catch
log something wrong

I use Pop3 not Imap, I can see delete successfully in log, but the message remains on the email server. I upgraded aspose email from 4.9 to 6.2 ( the DLL version). and this piece of code worked perfectly fine in 4.9. could you confirm that

1. there is a breaking change between 4.9 and 6.2 that my code will no longer work?
2. could you advise a fix for pop3 implementation?

Thanks

an other questions for disconnecting from server. in 6.2 Disconnect method has been deprecated, document says use Dispose instead, will Dispose actually disconnect the connection? do I need to call something else to explicitly disconnect server before calling Dispose?

thanks

Hi,


1. We have tested this with Pop3Clieint as well and with the use of CommitDeletes, we are not able to reproduce the problem at our end. The messages are deleted fine from the server. We don’t find the use of CommitDeletes in your sample code which shows it to be the missing statement that may have given rise to the problem. Please try it with the latest version of the API and using CommitDeletes method and let us know your feedback.

2. The use of Dispose will dispose the whole object and disconnect the connection to the server after completion of the current operation. If you face any issue in this regard, please feel free to share with us.