解決jdk1.8傳送郵件SSL握手失敗問題
阿新 • • 發佈:2019-02-17
今天在寫一個郵件傳送Demo的時候,出現了下面的問題
傳送郵件失敗Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 465;
nested exception is: javax.NET.ssl.SSLHandshakeException: Received fatal alert: handshake_failure. Failed messages: javax.mail. MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 465;
nested exception is: javax.Net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
花了一個下午在網上查資料發現是jdk1.8的安全驗證有問題,只需要去官網下載相關jar換掉即可
這兩個jar包的下載地址:http://www.Oracle.com/technetwork/Java/javase/downloads/jce-7-download-432124.html。
Ok 大功告成。