简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM