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

Free Support Forum - aspose.com

Email Exception

in outloook there’s a erroer text box that gives errors is there a example how to handle exception when receiving(pop and imap) and sending(smtp) im sure a try catch is what i need. sample code


private void loadImap(DataRow row)<o:p></o:p>

{

lblName.Text = row["email"]+" - Receiving";

using (var client = new ImapClient())

{

ds = new DocumentStore();

client.SelectFolder(ImapFolderInfo.InBox);

setIEncription(Convert.ToInt32(row["iEncription"]));

client.Host = row["iServer"].ToString();

client.Username = row["iUserName"].ToString();

client.Password = row["iPassword"].ToString();

client.Port = Convert.ToInt32(row["portPopImap"]);

client.SecurityOptions = iEncription;

// client.UseAuthentication = true;

ImapMessageInfoCollection list = client.ListMessages();

MailMessage msg;

for (int i = 0; i < list.Count; i++)

{

msg = client.FetchMessage(list[i].UniqueId);

lblStatus.Text = String.Format("{0} of {1} Emails have been competed successfully", i, list.Count);

using (MemoryStream fs = new MemoryStream())

{

client.SaveMessage(i, fs);

MailStore.InsertEmail(msg, Convert.ToInt32(row[0]), ds.saveStreamDoc(fs, String.Format("{0}.eml", list[i].UniqueId), 0, 14, 0, 0));

//set email links

}

}

}

}

Hi Joseph,


Thank you for contacting Aspose support team.

Aspose.Email contains lot of exception handling classes those can be used to catch exceptions using try catch blocks in the code. Details of such exception can be found under relevant class in the Aspose.email for .NET API Reference section.

Outlook error text box is a UI element which is specific to Outlook for displaying the message, however there is no alternate UI element in Aspose,Email for this purpose.

You may also please have a look at the following articles which can be used to log the activities for finding any abnormality during the normal operations:

  1. Smtp client activity logging
  2. ImapClient and Pop3Client activity logging

Please feel free to write us back if you have any other query in this regard.