The remote certificate is invalid according to the validation procedure.

Posted by Shanky11 under ASP.NET on 10/23/2012 | Points: 10 | Views : 3393 | Status : [Member] | Replies : 4
The remote certificate is invalid according to the validation procedure.?????????????????????
codi is--------------- string strFromAddress = ConfigurationSettings.AppSettings["MailFrom"];
MailMessage mailMessage = new MailMessage(strFromAddress, toaddress);
mailMessage.Subject = "Request For Registration";
string strUserName = ConfigurationSettings.AppSettings["UserName"];
string strPassword = ConfigurationSettings.AppSettings["Password"];

mailMessage.IsBodyHtml = true;
string strMailContent = " You have an request pending for registration from email id :" + toaddress;
mailMessage.Body = strMailContent;
SmtpClient mailSender = new SmtpClient(); //use this if you are in the development server
mailSender.Host = ConfigurationSettings.AppSettings["HostPath"];
mailSender.Port = 465;
mailMessage.IsBodyHtml = true;
mailSender.Credentials = new System.Net.NetworkCredential(strUserName, strPassword);
mailSender.EnableSsl = true;
mailSender.Send(mailMessage);


string flage = "successfully";
return flage;




Responses

Posted by: Jayakumars on: 10/23/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

check your credential correctly or not check your port also

Mark as Answer if its helpful to you

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 10/23/2012 [Member] Starter | Points: 25

Up
0
Down
credentials is all rt and port is 465

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Seng2hs on: 10/23/2012 [Member] Starter | Points: 25

Up
0
Down
try using

mailserver: smtp.gmail.com
username : gmailaccount
password: urpssword
port: 587

This wil work



Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 10/23/2012 [Member] Starter | Points: 25

Up
0
Down
tried this also
server does not support secure connection

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response