19.springboot邮件服务服务器部署访问不到邮箱服务器解决方案

1.前言

在Springboot项目的生产环境中,win系统环境下,邮箱服务是可以正常使用的。

当项目部署到阿里云服务器上之后,因为服务器端口采用安全组的方式,25端口访问不到。

在网上查找了一部分资料之后,成功找到了解决方案。

2.解决方案

代码什么的都不需要动,只需要添加邮箱SSL配置和端口配置就可以了。

#配置邮箱协议
spring.mail.default-encoding=utf-8
spring.mail.username=xxxxxxxx@163.com
spring.mail.host=smtp.163.com
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.socketFactory.port=465
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
spring.mail.password=xxxxxxxxxxxxx
posted @ 2019-01-21 14:44  零度微笑  阅读(642)  评论(1编辑  收藏  举报