We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Email CommitDeletes() method gives and error

Hi ,
I am using as-pose.email for reading and deleting an email using pop3Client. When i am trying to delete read email one by one using pop3 client CommitDeletes() method, it gives an error message like below

User command error: -ERR Connection is closed. 12

I am not able to understand reason. Please help ASAP.

Also below is code i am using …

//Instantiate the License class
Aspose.Email.License license = new Aspose.Email.License();

//Pass only the name of the license file embedded in the assembly
license.SetLicense(“License File Name”);

Pop3Client Clnt = new Pop3Client();

try
{
//Basic settings (required)
Clnt.Host = ServerName;
Clnt.Username = Username;
Clnt.Password = Utilities.AESCryptography.Decrypt(Password, Utilities.AESCryptography._eKey);
Clnt.SecurityOptions = (IsSSL ? SecurityOptions.SSLImplicit : SecurityOptions.Auto);
Clnt.Port = Port;

string BodyMessage = string.Empty;
string BodySubject = string.Empty;
Aspose.Email.Pop3.Pop3MessageInfoCollection msgList = Clnt.ListMessages();

foreach (Aspose.Email.Pop3.Pop3MessageInfo msgInfo in msgList)
{
// Get the POP3 message’s unique ID
string strUniqueID = msgInfo.UniqueId;

if (strUniqueID != null)
{
Clnt.DeleteMessage(strUniqueID);
try
{
Clnt.CommitDeletes();
}
catch (Exception Ex)
{
throw Ex;
}
}
}
}
catch (Exception Ex2)
{
throw Ex2;
}
finally
{
Clnt.Dispose();
}


Hi Muhamad,


Thank you for writing to Aspose support team.

I have tested this code using one of my test account on Gmail and deleted hundreds of emails without any error. It seems to be some issue with your account or mail server. Could you please provide us a test account on the said mail server along with the credentials for our testing here? We will test issue on your server and assist further accordingly.