發送郵件報以下錯誤。smtp服務器是smtp.live.com,有要求安全鏈接(SSL)java
2009-04-27 10:35:39,421 ERROR [STDERR] javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
2009-04-27 10:35:39,421 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
2009-04-27 10:35:39,421 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
2009-04-27 10:35:39,421 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
2009-04-27 10:35:39,421 ERROR [STDERR] at javax.mail.Service.connect(Service.java:275)
2009-04-27 10:35:39,421 ERROR [STDERR] at javax.mail.Service.connect(Service.java:156)安全
在網上找了資料。最後用下面的方式解決:服務器
在配置JavaMail的Properties事,不要指定「mail.smtp.socketFactory.class」,由於TLS使用的是普通的Socket。而後指定屬性「mail.smtp.starttls.enable」爲「true」。socket