在jdk1.4中我可以发送邮件,但是当我尝试使用jdk1.6发送邮件时,我得到以下异常。
My Working Environment. ======================== 1.OS : windwos 2008 2.JAVA : JDK1.6 3.Mail Api : java mail1.4 4.Email : gmail 5.smtp port: 465 or 587
Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingExcep tion: Can't send command to SMTP host; nested exception is: javax.net.ssl.SSLKeyException: RSA premaster secret error at SendMailTLS.main(SendMailTLS.java:47) Caused by: javax.mail.MessagingException: Can't send command to SMTP host; nested exception is: javax.net.ssl.SSLKeyException: RSA premaster secret error at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1365) at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1353) at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:794) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:33 6) at javax.mail.Service.connect(Service.java:258) at javax.mail.Service.connect(Service.java:137) at javax.mail.Service.connect(Service.java:86) at javax.mail.Transport.send0(Transport.java:150) at javax.mail.Transport.send(Transport.java:80) at SendMailTLS.main(SendMailTLS.java:42)
答案 0 :(得分:0)
您使用的是JDK的lates版本吗? 你能提供不起作用的源代码吗? 请显示邮件代码的输出: