gpt4 book ai didi

c# - 无法发送电子邮件 :( - The remote certificate is invalid according to the validation procedure

转载 作者:太空宇宙 更新时间:2023-11-03 14:41:24 24 4
gpt4 key购买 nike

    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);

//每次我收到此错误消息以及如何处理此消息时,这是否是绕过公司 ssl 的安全漏洞?请建议处理此代码和发送电子邮件的最佳方式。

最佳答案

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

...tell StmpClient to ignore security with

client.EnableSsl = true;

关于c# - 无法发送电子邮件 :( - The remote certificate is invalid according to the validation procedure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42825773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com