JavaMail SSL with no Authentication trust certificate regardless

后端 未结 3 450
自闭症患者
自闭症患者 2021-01-13 06:58

I have a local mail server (hMailServer) with SSL (port 465) and a self-signed certificate.

Domain is \"foobar.com\"

I have setup my Properties

相关标签:
3条回答
  • 2021-01-13 07:12

    This the solution for JavaMail SSL with no Authentication trust certificate using Spring framework, change your .xml file as describe below.You can see the solution in the snapshot See the image description here

    javax.net.ssl.SSLSocketFactory true

    change it to false if you want mail server must be in ssl

    0 讨论(0)
  • 2021-01-13 07:25

    The best solution for this is to use the following line

        MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
        socketFactory.setTrustAllHosts(true);
    
    0 讨论(0)
  • 2021-01-13 07:26

    You asked for an "smtps" transport. You set the properties for the "smtp" transport. Since you've set the "mail.smtp.ssl.enable" property to "true", you can just ask for an "smtp" transport and it will use SSL.

    0 讨论(0)
提交回复
热议问题