0

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
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
ayengin
  • 1,606
  • 1
  • 22
  • 47

2 Answers2

2

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.

Rob Harrop
  • 3,445
  • 26
  • 26
0

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.

nuzz
  • 647
  • 7
  • 18
  • I think it should be `mail.smtp.ssl.trust=*`. `checkserveridentity` means that the server name (the one the socket connects to) must match the certificate's subject. My understanding is OP wants to inactivate trust verification for certain certificates. See http://javamail.kenai.com/nonav/javadocs/com/sun/mail/smtp/package-summary.html – home Jul 14 '11 at 11:49