错误日志:The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
问题原因:Microsoft 帐户认为有异常登录行为导致的
解决方案:
1、在个人中心-安全-登录活动-找到对应发送邮箱的服务器的登录情况,设为是自己
2、重设密码【关键】
hotmail
服务器名称: smtp.office365.com
端口: 587
加密方法: STARTTLS
SmtpClient smtp = new SmtpClient(host, Port);
//超时时间
smtp.Timeout = 20000;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
//关键
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
//指定发件人的邮件地址和密码以验证发件人身份
smtp.Credentials = new System.Net.NetworkCredential("邮箱", "密码");
smtp.Send(myMail);