首页 > 其他分享 >Sending the email to the following server failed.IOException while sending message问题解决

Sending the email to the following server failed.IOException while sending message问题解决

时间:2022-10-28 15:04:51浏览次数:74  
标签:Sending java sending sun server org mail com javax


背景

最近在全职负责的报表开发平台,有一个看板订阅功能,即按照设置的调度时间定时把看板数据加载为字节流发送到用户配置的指定邮箱。

然后偶发性地出现邮件发送失败问题,执行日志截图:

Sending the email to the following server failed.IOException while sending message问题解决_https

排查

上面报错日志:

ERROR MailService - sendEmail error
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.partner.outlook.cn:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at org.aaa.services.MailService.sendEmail(MailService.java:667)
at org.aaa.services.MailService.sendEmail(MailService.java:316)
at org.aaa.services.MailService.sendDashboard(MailService.java:138)
at org.aaa.services.job.JobService.sendMail(JobService.java:369)
at org.aaa.services.job.MailJobExecutor.execute(MailJobExecutor.java:129)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: javax.mail.MessagingException: IOException while sending message
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1244)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
... 8 common frames omitted
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:876)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:847)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:128)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
at com.sun.mail.util.CRLFOutputStream.write(CRLFOutputStream.java:84)
at com.sun.mail.smtp.SMTPOutputStream.write(SMTPOutputStream.java:87)
at com.sun.mail.util.CRLFOutputStream.write(CRLFOutputStream.java:75)
at com.sun.mail.util.BASE64EncoderStream.write(BASE64EncoderStream.java:140)
at javax.activation.DataHandler.writeTo(DataHandler.java:309)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1608)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:961)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:553)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:103)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:889)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1608)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1849)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1196)

收不到邮件

几种可能:

  1. 用户已离职,此账户在LDAP系统已处于失效状态
  2. Sending the email to the following server failed.IOException while sending message问题解决_https_02

  3. 邮件地址有误,比如本应发送给@google.com,用户填写收件地址时写错为@gooogle.com
  4. 收件人的邮箱已满
  5. Sending the email to the following server failed.IOException while sending message问题解决_https_03

  6. 邮件内容体过大
  7. Sending the email to the following server failed.IOException while sending message问题解决_邮件发送_04

  8. 邮件server端有发送记录却收不到邮件
    有些时候,mail server端有发送成功的记录,但是收件人反馈收不到邮件
  9. Sending the email to the following server failed.IOException while sending message问题解决_ssl_05

  10. 得找IT运维排查下邮件发送记录,以下面的截图为准
  11. Sending the email to the following server failed.IOException while sending message问题解决_https_06

  12. 邮件转发规则设置有误
  13. Sending the email to the following server failed.IOException while sending message问题解决_apache_07

  14. 在outlook里面发送邮件,写草稿箱,是可以正常显示收件人信息:
  15. Sending the email to the following server failed.IOException while sending message问题解决_java_08

  16. 咨询运维,看日志是发送成功的:
  17. Sending the email to the following server failed.IOException while sending message问题解决_ssl_09

  18. 进一步看发送日志:
  19. Sending the email to the following server failed.IOException while sending message问题解决_apache_10

  20. 用户在outlook邮箱客户端,设置过转发规则,转出到外部邮箱,所以邮件发送动作被邮件服务器拒绝。

值得一提的是,客户端设置自动转发规则,有3种:

Sending the email to the following server failed.IOException while sending message问题解决_https_11


前两种是自己收到邮件之后,自己作为邮件发送方,再转发;第三种是直接转发出去。英文版本:

Sending the email to the following server failed.IOException while sending message问题解决_ssl_12


参考​​Redirect vs. Forward Email​

In a standard forward, the person forwarding the message appears to be the sender. In a redirection, the message appears to come from the original sender.


标签:Sending,java,sending,sun,server,org,mail,com,javax
From: https://blog.51cto.com/u_15851118/5804877

相关文章

  • Kafka Server单节点部署(Linux 环境)
    Kafka单节点部署(Linux环境)运行环境:CentOS7.6x64JDK环境:JDK11(请参考JDK的安装和配置(Linux环境))一、Kafka安装包获取1-1kafka官网1-2WinSCP上传(注意:CentOS切换到ro......
  • SQL Server 常用
    SQLServer常用函数整理SQLServer常用函数整理_凯酱的博客-CSDN博客_sqlserver常用函数 SQLServer数据库语句大全汇总SQLServer数据库语句大全汇总(wjhsh.net) ......
  • 拉取镜像报Error response from daemon: Get https://: http: server gave HTTP respo
    现象:拉取镜像报Errorresponsefromdaemon:Gethttps://:http:servergaveHTTPresponsetoHTTPSclientharbor默认是https协议的,如果想要通过http协议拉取harbor的......
  • SQL Server之选出某个字段中全部为数字或全部为字母的记录
    https://blog.csdn.net/jclian91/article/details/78197736这个问题可以用SQL的通配符来解决,我们以下面的sample_table表为例: 现在我们选出表......
  • 【Serverless】快速集成云函数HarmonyOS
    ​1、学习目标什么是AppGalleryConnect云函数云函数是一项Serverless计算服务,提供FaaS(FunctionasaService)能力,可以帮助开发者大幅简化应用开发与运维相关事务,降低应......
  • Windows Server 上安装Emqx
    EMQX是中国杭州一家科技公司(公司名叫EMQ)发布的面向5G和物联网市场的消息与流处理开源软件。2013年,EMQ作为一个开源项目在Github:https://github.com/emqx/emqx上发布,......
  • Understanding Nginx Server and Location Block Selection Algorithms
    IntroductionNginxisoneofthemostpopularwebserversintheworld.Itcansuccessfullyhandlehighloadswithmanyconcurrentclientconnections,andcan......
  • Win server 2012R2 DNS占用大量端口侦听的解决方式
    请运行一下下面的命令查看DNS服务占用的端口数量:netstat-anb|find/C"dns.exe"server2016上:server2012R2上:之后运行以下的命令修改DNSsocketpoolsize的大小,......
  • k8s 安装metrics-server
    下载:https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yamlcomments.yaml文件修改:containers:-args:--......
  • Jumpserver2.23部署手册
    1、配置系统:Centos7.9*2配置:2CUP*4G192.168.100.102:数据库几redis服务器192.168.100.103:jumpserver服务器2、要求需要连接互联网使用root用户执行官网地址:http......