开发者

Java SMTPS untrusted certificate

开发者 https://www.devze.com 2023-03-20 11:54 出处:网络
When sending mail with SMTPS, I am setting the following property, so I am expecting certificate validation to be skipped. But my untrusted certificate is causing an exception.

When sending mail with SMTPS, I am setting the following property, so I am expecting certificate validation to be skipped. But my untrusted certificate is causing an exception.

mailConf.put("mail.smtps.ssl.checkserveridentity", "false");

The exception is:

sun.security.validator.ValidatorException: PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: 
    unable to find valid certification path开发者_开发百科 to requested target


You have a slight error in your property name. It should be mail.smtp.ssl... not mail.smtps.ssl.... Notice that it is smtp not smtps.


Um, Looking through the docs, I have to wonder if you have made a typo. I can't find mail.smtps.ssl.checkserveridentity, but I can find mail.smtp.ssl.checkserveridentity.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号