一段时间后,Coldfusion 停止使用 smtp.gmail.com 发送电子邮件

Coldfusion stops sending emails, using smtp.gmail.com, after a while

我使用 smtp.gmail.com:465 作为 coldfusion 的邮件服务器。我使用命令 openssl s_client -connect smtp.gmail.com:465 获取其证书并将其导入其 Java 信任库。

它可以完美运行一段时间,没有任何问题。然后在随机数周后它停止工作并给出此错误:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; 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

抓取证书并再次导入后它可以工作。

我不得不一直这样做很烦人。

任何人都知道可能导致问题的原因以及可能的解决方案吗?

经过一些挖掘,我意识到 java 信任库 (cacert) 缺少所有根 CA 证书,包括 gmail 的根 CA。 A 找到了包括 gmail 在内的通用根 CA 证书列表,并将它们导入到信任库中。