Tuesday, 20 March 2012

Email Error The remote certificate is invalid according to the validation procedure.

Question:- Email Error The remote certificate is invalid according to the validation procedure.

Answer:-
using System.Net.Mail;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;


// add below  code  before  send () method  like 
 SmtpClient client = new SmtpClient(); 

 ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

  client.send(msg);

      

No comments:

Post a Comment