/ 17浏览

Java 发送邮件异常 SSLHandshakeException

idea直接运行正常,打jar包后运行报以下错误

Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

添加如下属性解决

setCustomProperty("mail.smtp.starttls.required", true);
setCustomProperty("mail.smtp.ssl.protocols", "TLSv1.2");