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)
{
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
}
}
}
}