1
votes

In jdk1.4 I can send mail, but when i try to send mail using jdk1.6 I get the below exception.

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)
1

1 Answers

0
votes

Are you using the lates version of JDK? Could you provide source code which not working? Please, show the output from mail code:

  • System.out.println("Java version: " + System.getProperty("java.version"));
  • System.out.println("Ext dirs: " +System.getProperty("java.ext.dirs"));