使用JavaMail.jar和Activation.jar在java中发送邮件时遇到问题

时间:2016-05-09 08:31:12

标签: java javamail office365

我正在尝试将邮件从办公室365邮件ID发送到另一个java.I已在项目中添加了mail.jar和activation.jar。但面临以下异常。

javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
    java.net.SocketException: java.security.NoSuchAlgorithmException: Default SSLContext not available
    at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1907)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:666)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at agent.client.attributeGroups.SendReceive.sendMail(SendReceive.java:75)
    at agent.client.attributeGroups.MailQueue.calculateTime(MailQueue.java:39)
    at agent.client.MainClass.<init>(MainClass.java:59)
    at agent.client.MainClass.main(MainClass.java:152)
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Default SSLContext not available
    at javax.net.ssl.DefaultSSLSocketFactory.a(SSLSocketFactory.java:2)
    at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:7)
    at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:485)
    at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1902)

请帮我解决此异常。

0 个答案:

没有答案