Posted on: 3/22/2015 10:50:41 AM | Views : 674

I have written below code for contact us page . I checked using breakpoints line (smtp.send(myMail) ) get error and break point jump to directly catch block
and get error is " complusexceptioncode -532462766"
help me

code :

MailMessage myMail = new MailMessage();
myMail.From = new MailAddress("me@mydomain.com"); myMail.Subject = "Contact Form";
MailAddressCollection myMailTo = new MailAddressCollection(); myMail.To.Add("me@mydomain.com");
StringBuilder sb = new StringBuilder(); sb.Append("Last Name: " + txtFirstName.Text + "<br>");
sb.Append("First Name: " + txtLastName.Text + "<br>"); string strBody = sb.ToString(); myMail.Body = strBody;
myMail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient(); smtp.Credentials = CredentialCache.DefaultNetwork ...

Go to the complete details ...