[英]Could not convert socket to TLS on Apache Commons Mail
I have a problem connecting to a SMTP Server with Apache Commons Mail. 我用Apache Commons Mail连接到SMTP服务器时遇到问题。 I have tried everything but the only thing I can find online is for Java Mail.
我已经尝试了所有方法,但是只能在网上找到Java Mail。 This is my error:
这是我的错误:
Caused by: javax.mail.MessagingException: Could not convert socket to TLS;
原因:javax.mail.MessagingException:无法将套接字转换为TLS;无法将套接字转换为TLS。 nested exception is: 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
嵌套的异常是:javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效证书路径
I have seen that you can fix the issue on Java Mail with props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
我已经看到您可以使用
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
来解决Java Mail上的问题props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
for example, but I can't a equivalent command to use on Apache Commons. 例如,但是我不能在Apache Commons上使用等效命令。
If you're really connecting to Gmail, you shouldn't need that. 如果您确实要连接到Gmail,则不需要。 The Gmail certificate will be trusted by the default trust store.
默认的信任库将信任Gmail证书。 If you've configured a non-default trust store, add the Gmail certificate to that trust store using the InstallCert program.
如果您配置了非默认信任库,请使用InstallCert程序将Gmail证书添加到该信任库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.