发送邮件报如下错误。smtp服务器是smtp.live.com,有要求安全连接(SSL)
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”。