Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

Email Exception

$
0
0
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

privatevoid loadImap(DataRow row)

         {

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

             using (var client = newImapClient())

             {

                 ds = newDocumentStore();

                 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 = newMemoryStream())

                     {

                         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

                     }

                 }

             }

         }


Viewing all articles
Browse latest Browse all 1367

Trending Articles