我正在尝试通过spring java mail API发送邮件,而我的邮件服务器是outlook。
所以我面临以下问题。
有时会与smpt主机建立连接,有时会返回连接超时。
下面我正在粘贴堆栈跟踪。
SMTP host:example.com.mail.protection.outlook.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailS enderImpl.java:404)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSen derImpl.java:332)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSen derImpl.java:347)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSen derImpl.java:336)
at com.condivision.rentongo.service.MailService.sendMail(MailService.jav a:75)
at com.condivision.rentongo.service.MailService$$FastClassBySpringCGLIB$ $1ed18523.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:2 04)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterce ptor.intercept(CglibAopProxy.java:649)
at com.condivision.rentongo.service.MailService$$EnhancerBySpringCGLIB$$ 5228ed74.sendMail(<generated>)
at com.condivision.rentongo.service.OrderService.updateOrderAndInventory Status(OrderService.java:726)
at com.condivision.rentongo.service.OrderService$$FastClassBySpringCGLIB $$a056f002.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:2 04)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation .invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.