使用smtp-mail.outlook.com发送邮件时遭遇“Authentication unsuccessful, basic authentication is disabled”错误的求助
使用smtp-mail.outlook.com发送邮件时遭遇“Authentication unsuccessful, basic authentication is disabled”错误的求助
我知道关于这个问题的问答有很多,但试遍了各种方法还是没解决,实在没办法来求助了😭
我的需求很简单:就是通过smtp-mail.outlook.com发送邮件,但最近一直失败,抛出的异常是:
The SMTP server requires a secure connection or the client was not authenticated. The server's response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled.
下面是我已经尝试过的所有方案,但都没效果:
- 怀疑是微软密码过期问题:即使账号没有设置密码过期规则,还是特意修改了密码,结果错误依旧
- 新建了一个Hotmail账号测试,问题完全一样
- 开启了双因素认证,生成了应用专用密码代替原密码,还是同一个错误
- 更换过多种SMTP配置:
- 尝试过不同的SMTP服务器:
outlook.office365.com、smtp.live.com、smtp-mail.outlook.com - 尝试过不同端口:587、993、25
- 代码里试过加不加
DeliveryMethod = SmtpDeliveryMethod.Network EnableSsl设为true或false都试过
- 尝试过不同的SMTP服务器:
- 想尝试OAuth认证,但注册应用的选项是灰色的,根本没法操作
附上我当前的C#代码片段:
var password = Helpers.PasswordEncyripter.Decrypt(mailConfig.Mai_Password); // 试过原账号密码和应用专用密码 SmtpClient smtpServer = new SmtpClient(mailConfig.Mail_OutgoingServer); // 当前用的是smtp-mail.outlook.com,也试过其他 smtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; // 加不加这行都试过 smtpServer.Port = mailConfig.Mail_Port.Value; // 试过587、993、25 smtpServer.UseDefaultCredentials = false; smtpServer.Credentials = new NetworkCredential(mailConfig.Mail_Sender, password); smtpServer.EnableSsl = mailConfig.Mail_SSL == true; // true和false都试过 smtpServer.Send(message);
所有方法都试过了还是发不出邮件,有没有大佬能给点思路啊?
内容来源于stack exchange
相关产品推荐
相关产品推荐

