how to ignore server cert error in javamail

后端 未结 10 1315
长发绾君心
长发绾君心 2020-12-05 07:12

when i connect to my imap server using imaps,it failes.

can you tell me how to ignore server cert error in javamail

Exception in thread \"main\"
java         


        
10条回答
  •  -上瘾入骨i
    2020-12-05 07:55

    I was the same issue, using

    MailSSLSocketFactory socketFactory= new MailSSLSocketFactory();
    socketFactory.setTrustAllHosts(true);
    prop.put("mail.pop3s.ssl.socketFactory", socketFactory);
    

    com.sun.mail.util.MailSSLSocketFactory

    it's works!!

提交回复
热议问题