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
.