本文主要是介绍关于javamail-with-ms-exchange-no-authentication-mechansims-supported-by-both-server错误的解决办法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近在写邮件相关的程序的时候碰到一个错误,javamail-with-ms-exchange-no-authentication-mechansims-supported-by-both-server 字面上的意思,身份验证有问题。于是开始google
If you're trying to connect to your mail server without authentication, call the connect method thatdoesn't take a username and password. If you pass it a username and password, it thinks you reallywant to authenticate, and since it can't find an authentication mechanism that the server supports, it fails ------bill shannon
--意思就是:如果你想要在不使用身份验证情况下连接邮件服务器,那么你调用的方法不应该带有用户名和密码。如果你使用了用户名密码,服务器会当你是想正式登录邮箱,邮件服务器无法找到对应的身份验证机制时,就会产生该错误。
问题出现原因:配置了身份校验,而这个邮件服务器是内网中的邮件服务器,无需身份校验即可发送邮件。邮件服务器也没有提供相应的身份验证方法。因此报错。
解决办法:去除SMTP协议中的身份校验 mail.smtp.auth 设定为false ,并将密码设定为空。邮件发送成功~
这篇关于关于javamail-with-ms-exchange-no-authentication-mechansims-supported-by-both-server错误的解决办法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!