Error in JavaMail : PKIX path building failed unable to find valid certification path to requested target

前端 未结 6 1732
北荒
北荒 2020-12-14 07:27

I am trying to build an email client app in android and right now i want to configure the javaMail part.

i am trying to establish the connection with the imap server

6条回答
  •  天涯浪人
    2020-12-14 07:31

    You can try upgrade library javax.mail.jar at https://java.net/projects/javamail/pages/Home (now version is 1.5.5) and add code :

    MailSSLSocketFactory sf = new MailSSLSocketFactory();
    sf.setTrustAllHosts(true); 
    properties.put("mail.imap.ssl.trust", "*");
    properties.put("mail.imap.ssl.socketFactory", sf);
    

提交回复
热议问题