【发布时间】:2015-09-29 00:58:04
【问题描述】:
所以我正在尝试使用 Java 将代码发送到我的电子邮件。我从 javax.mail 开始,但记得我上次使用它时遇到了问题,所以我转向了 Apache Commons Mail。
不过,我遇到了一堆错误。在 SSL 上,我收到了 java.net.SocketTimeoutException,在 TLS 上,我收到了一些错误:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2000)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
当我在 Google 上进行快速搜索时,我找到了this question。现在因为我是个彻头彻尾的白痴,所以我不明白答案。
我可以做些什么来解决这些错误?无论是防止 SSL 超时还是其他 TLS 超时。
编辑:我发送电子邮件没有问题,MessageException 不是我的问题,所以请停止回答。
【问题讨论】:
-
发布您的代码!您使用哪个邮件提供商发送邮件?
-
@kevcodez 我正在使用 GMail。不过,我认为这部分实际上并不相关。