使用邮箱服务时遇到一个问题: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
由于是自搭建的邮箱服务,服务器地址不被信任,需要ssl.trust。我的项目是springcloud 的,在yml文件使用mail配置:
# 发送邮件配置 mail: host: #邮箱服务地址 port: 587 username: #邮箱账号 password: #邮箱密码 properties: mail: smtp: ssl: trust: #邮箱服务地址 auth: true starttls: enable: true