使用SpringBoot发送邮件 在本地测试是好的 放到服务器连接超时问题

原因

原来是ECS基于安全考虑,禁用了端口25。改成465就可以发邮件了。

原始配置  本地可发送 

#spring.mail.host=smtp.qq.com
#spring.mail.username=qq
#spring.mail.password=password
#spring.mail.properties.mail.smtp.starttls.enable=true
#spring.mail.properties.mail.smtp.auth=true
#spring.mail.properties.mail.smtp.starttls.required=true

修改的配置 测试 部署到服务器上是可以发送的

spring.mail.host=smtp.qq.com
spring.mail.username=qq
spring.mail.password=password
spring.mail.default-encoding=UTF-8
spring.mail.port=465
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.debug=true

参考

https://www.cnblogs.com/redips-l/p/8195761.html

https://blog.csdn.net/zhaokejin521/article/details/80859834

posted @ 2018-12-06 17:10  yinder  阅读(397)  评论(0编辑  收藏  举报