1、报错信息
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration]: Constructor threw exception
2、原因
出于安全考虑,某云服务器默认封禁了 TCP 25 端口出方向的访问流量,无法在某云上的云服务器通过 TCP 25 端口连接外部地址
3、解决
(1)申请解封 TCP 25 端口,参考:
https://help.aliyun.com/document_detail/56130.html
(2)修改端口,改为SSL连接,配置示例:
spring:
mail:
test-connection: true
host: smtp.qq.com
# 邮件服务器的SMTP端口。QQ邮箱使用465
p