提问人:rvchauhan 提问时间:5/19/2023 最后编辑:Eugene Astafievrvchauhan 更新时间:5/19/2023 访问量:112
SMTP 服务器需要安全连接,或者客户端未经过身份验证。服务器响应为:5.7.57客户端未通过身份验证发送邮件
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57Client not authenticated to send mail
问:
无法使用 SMTP 从 office365 电子邮件发送电子邮件。每次都收到此错误。我尝试了很多方法,也允许来自管理中心的 SMTP。还更改了密码。
错误:SMTP 服务器需要安全连接,或者客户端未经过身份验证。服务器响应为:5.7.57 客户端未通过身份验证发送邮件。错误:535 5.7.3 身份验证失败 [PN3PR01CA0040.INDPRD01.PROD.OUTLOOK.COM 2023-05-18T11:19:25.007Z 08DB572806B55A65]
var smtpClient = new SmtpClient("smtp.office365.com", 587);
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential("[email protected]", "xxxxxx");
smtpClient.EnableSsl = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.TargetName = "STARTTLS/smtp.office365.com";
// Create the email message
var messageMain = new MailMessage();
messageMain.From = new MailAddress("[email protected]");
messageMain.To.Add("[email protected]");
messageMain.Subject = "Hello from ASP.NET MVC";
messageMain.Body = "This is the body of the email.";
smtpClient.Send(messageMain);
答: 暂无答案
评论