写一个QQ邮件发送,运行时报下面的错误。
百度翻译是:线程“main”javax.mail.MessagingException异常:无法连接到SMTP主机:SMTP.qq.com,端口:465;嵌套异常为:javax.net.ssl.ssl握手异常:没有合适的协议(协议被禁用或密码套件不合适)
解决方法:上面报错信息显示协议被禁用了,这里的JDK使用的是17,打开C:\Program Files\Java\jdk-17\conf\security找到文件java.security,打开后将这个协议打开。将726和727行的代码注销掉(如下图)。
- MessagingException quot Exception connect threadmessagingexception quot exception connect outofmemoryerror quot exception thread unsatisfiedlinkerror quot exception thread classnotfoundexception quot exception thread messagingexception response connect aliyun assertionerror exception thread main sqlexception connection exception interrupt nacosexception exception connected starting established connection exception办法 quot exception rabbitmq reason