springboot mail 异常记录(项目)

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

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

修改配置文件


                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值