Java SMTPS untrusted certificate
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.
精彩评论