The remote certificate is invalid according to the validation procedure.
mail.From = new MailAddress("abc@gmail.com");//My Gmail ID string emp = ""; mail.To.Add(txtemail.Text); mail.Subject = "Confirmations of User Name && Password"; StreamReader reader = new StreamReader("HTMLPage1.htm"); string readFile = reader.ReadToEnd(); string myString = readFile; string date = System.DateTime.Now.Date.ToShortDateString(); string str = PopulateBodyEnquiry(txtCmp.Text, UserName, UserName, Pwd, date); mail.Body = str; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("mygmailId", "password"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate(object sender2, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }); smtp.Send(mail);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)