qq_36745087
me-ht
2017-08-04 03:47

发送邮件功能在生产环境失效

  • 邮箱
  • 服务器
  • 邮件
  • 异常

同样的一套代码,在本地能够发送邮件,在测试服务器能够发送邮件,但是在生产服务器不能发送邮件。
在生产服务器上发送邮件报异常
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketTimeoutException: Read timed out. Failed messages: javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketTimeoutException: Read timed out; message exception details (1) are:
Failed message 1:
javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketTimeoutException: Read timed out
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2153)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1912)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
at javax.mail.Service.connect(Service.java:295)
at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:501)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
at com.service.impl.MailServiceImpl.sendMail(MailServiceImpl.java:217)
at com.service.impl.MailServiceImpl$1.run(MailServiceImpl.java:78)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2131)
... 9 more
2017-07-19 18:53:51,041 - {"errcode":"-500","errmsg":"Read timed out"}
生产服务器和测试服务器用的是同一个邮箱服务器上的邮箱。
另外,生产服务器和邮箱的服务器的通讯是正常的。
请问是为什么会出现这种情况?怎么判断?如何检测?如何修改?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答

为你推荐

换一换