未知的SMTP主机 [英] Unknown SMTP host

查看:114
本文介绍了未知的SMTP主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个使用tomcat的Java Web应用程序,以通过电子邮件将生成的报告发送给用户. 我可以发送电子邮件,但是几个小时后服务器停止发送电子邮件,并出现以下错误.

I am running a Java web application using tomcat to send generated reports via emails to the users. I am able to send the emails but after few hours the server stops sending emails, with the following error.

javax.mail.MessagingException: Unknown SMTP host: mail.mydomain.co.uk;
nested exception is:
java.net.UnknownHostException: mail.mydomain.co.uk
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1970)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at com.turnkey.email.SendEmail.sendMail(SendEmail.java:119)
at com.turnkey.thread.CommunicationThread.run(CommunicationThread.java:399)
Caused by: java.net.UnknownHostException: mail.mydomain.co.uk
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:319)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:233)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1938)
... 8 more

一段时间后,服务器会再次开始发送电子邮件.

After some time the server starts sending emails again.

谁能告诉我可能是什么问题. 而我该如何解决这个问题呢?

Can anyone tell me what could be the problem. And how do I solve this problem?

谢谢

推荐答案

这似乎是您的名称服务失败. JDK无法查找主机名以找到其Internet地址.由于此方法有时起作用,而不是其他方法起作用,因此看起来好像是名称服务的间歇性故障.名称服务故障可能是由于本地操作系统中的某些故障,也可能是由于与DNS服务器或其他名称服务服务器通信时出现网络故障,或者可能是该DNS服务器或名称服务服务器中的故障本身.确定故障的确切原因将需要进行一些调试.请注意,JDK将名称服务器查找的结果缓存了一段时间,因此您需要将其纳入调试中.

This looks like a failure in your name service. The JDK isn't able to look up the host name to find its internet address. Since this works sometimes and not others, it looks like an intermittent failure of the name service. The name service failure could be due to some failure in your local operating system, or it could be due to some network failure communicating with your DNS server or other name service server, or it could be a failure in that DNS server or name service server itself. Determining the exact cause of the failure will require some debugging. Note that the JDK caches the results of name server lookups for some time so you'll need to factor that into your debugging.

这篇关于未知的SMTP主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆