0
    public static void SendEmail(StringBuilder sb) {
            string mailbody = string.Empty;
            MailMessage mail = new MailMessage();
            SmtpClient smtpServer = new SmtpClient("aaaaa.com");
            smtpServer.Credentials = new System.Net.NetworkCredential("username", "pwd");
            //smtpServer.Port = 587;
            mail.IsBodyHtml = true;
            smtpServer.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            mail.BodyEncoding = System.Text.Encoding.UTF8;
            smtpServer.UseDefaultCredentials = true;
            smtpServer.EnableSsl = true;
            mail.From = new MailAddress("bbbb.com");
            mail.To.Add("ccccc.com");
            mail.Subject = string.Format("test");
            mailbody = sb.ToString();
            mail.Body = mailbody;
            smtpServer.Send(mail);

//everytime I get this error message and how to handle this, is this a security breach to bypass ssl in a company ? kindly advise the best way to handle this code and to send email. }

Santhosh
  • 1
  • 1
  • 2

1 Answers1

0

Try the Unexpected “ The remote certificate is invalid according to the validation procedure.”

...tell StmpClient to ignore security with

client.EnableSsl = true;
mqueirozcorreia
  • 905
  • 14
  • 33