Go Dady Smtp mail sending error

Feb 16 2015 5:46 AM

i am using Go Dady hiosting

this code is

MailMessage mm = new MailMessage("[email protected]", "[email protected]");
mm.Subject = txtSubject.Text;
mm.Body = "Name: " + txtName.Text + "<br /><br />Email: " + txtEmail.Text + "<br />" + txtBody.Text;

mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "[email protected]";
NetworkCred.Password = "password";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
lblMessage.Text = "Email Sent SucessFully.";
txtSubject.Text = "";
txtName.Text = "";
txtEmail.Text = "";
txtBody.Text = "";

this code is working with localhost but in Go Dady Server giving error as

The remote certificate is invalid according to the validation procedure.

Please help me i am new in asp.net, C#

Thank you

Abhinandan


Answers (3)