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

1.前言

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

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

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

2.解决方案

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

#配置邮箱协议
spring.mail.default-encoding=utf-8
[email protected]
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

猜你喜欢

转载自www.cnblogs.com/TimerHotel/p/springboot19.html