mail:
host: smtp.aliyun.com
username:
password:
port: 25
protocol: smtp
default-encoding: UTF-8
以上本地Windows环境测试发送邮件正常,大约在3s能收到邮件
Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.aliyun.com, 25; timeout -1;
nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out). Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.aliyun.com, 25; timeout -1;
以上是部署到Linux服务器上,异常信息
原因:https://help.aliyun.com/knowledge_detail/56130.html

修改配置文件
SpringBoot邮件发送异常及解决

在本地Windows环境中,使用SpringBoot发送邮件功能测试成功,但在Linux服务器上遇到连接超时的问题,错误信息涉及到smtp.aliyun.com。问题源于阿里云SMTP服务器的连接限制。根据官方文档,调整了配置,尝试通过465端口连接,但仍然出现连接异常。需要进一步排查SMTP服务器的设置或网络问题。
最低0.47元/天 解锁文章
6558

被折叠的 条评论
为什么被折叠?



