zoukankan      html  css  js  c++  java
  • 发邮件遇到 Failure sending mail.The remote name could not be resolved: 'www.youdomain.com' 问题的解决方法

    先排除代码的错误, 程序工作正常, 只是偶尔出现这个故障, 应该不是代码的问题.

    一.错误信息: Failure sending mail.The remote name could not be resolved: 'www.youdomain.com'
    二.错误原因: smtp域名到ip地址解析失败, 应该是dns的问题, 搜了一些帖子, 列在下面:

    1.Found the problem. I updated my DNS entries a few hours ago, and it appears the changes to smpt server is not yet available. I

    did a nslookup on my smpt server to get the ip, and then changed my mail server name to the IP, and then everything worked fine.

    2.In my opinion, this error message is quite self-explanatory: You cannot create a connection to the SMTP server you have

    specified.There is probably nothing wrong with your code as it is. You need to check why you can't access the SMTP server.
    For starters, try pinging smtp.nimanaqipour.com from the machine your application is running on.

    3.If it is having issues resolving the server name, then that is likely a DNS issue on the server. CS simply goes to the connect

    to the given hostname, and the system will automatically try to resolve the hostname into an IP using the DNS servers the server

    is configured to use.

    Take not of the email server setting in CS, then log into the server, open a command prompt, and type "nslookup

    youremailserver.com". if it can't resolve it, then you might want to check the DNS settings for the domain, or the DNS servers

    your server is set up to use.BTW: Before that, just check it's not the firewall creating the issue. Port being used is open and

    permissions given.

    三.解决办法:

    我觉得有两法可试一下:

    1.将smtp服务器由域名改为ip地址,省了解析的步骤。

    2.询问一下机房,是否干了什么坏事,然后,等待上一两天,自然好转。

    四.具体日志:
    ERROR 2011-09-28 13:41:02,960 [11] logException [(null)] -System.Net.Mail.SmtpException: Failure sending mail. --->

    System.Net.WebException: The remote name could not be resolved: 'www.yourdomain.com'
       at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket&

    abortSocket, Socket& abortSocket6, Int32 timeout)
       at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
       at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
       at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
       at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       --- End of inner exception stack trace ---
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at SystemFrameWork.clsMail.SendMailbySmtpClient()
       at SalesOrder.btn_Send_Click(Object sender, EventArgs e) in d:\test\send.aspx.cs:line 2907

    推荐:

    1.nslookup工具的使用方法

    http://www.5dmail.net/html/2003-11-14/20031114101959.htm


    用nslookup http://www.youdomain.com/ 时, 返回数据中有一个Non-authoritative answer, 它的意思是:未证实回答,出现此提示表明该域名的解析是从local DNS 的 cache 中直接读出来的(表明这个结果是从服务器的缓存中得到的  ),而不是local DNS 向真正负责这个域名的name server 问来的。这是因为比较常用的域名都会缓存起来,以快速完成解析。对于那些不常用或其他一些特别的域名,则需要逐级查询已完成解析。

    1.1 查询A记录

    C:\>nslookup http://www.cdnunion.com/
    *** Can't find server name for address 192.168.2.1: Non-existent domain
    *** Default servers are not available
    Server: UnKnown
    Address: 192.168.2.1

    Non-authoritative answer:
    Name:    http://www.cdnunion.com/
    Addresses: 61.129.102.61, 202.101.42.101

    61.129.102.61, 202.101.42.101是WWW对应的IP地址.

    1.2 查询MX记录
    C:\>nslookup -type=mx cdnunion.com
    *** Can't find server name for address 192.168.2.1: Non-existent domain
    *** Default servers are not available
    Server: UnKnown
    Address: 192.168.2.1

    Non-authoritative answer:
    cdnunion.com    MX preference = 8, mail exchanger = mail.cdnunion.com

    cdnunion.com    nameserver = ns2.cdnunion.com
    mail.cdnunion.com       internet address = 61.129.102.61

    mail.cdnunion.com是cdnunion.com对应的MX记录.

    1.3 查CNAME记录
    C:\>nslookup -type=cname http://www.kukudm.com/
    *** Can't find server name for address 192.168.2.1: Non-existent domain
    *** Default servers are not available
    Server: UnKnown
    Address: 192.168.2.1

    Non-authoritative answer:
    http://www.kukudm.com/ canonical name = http://www.kukudm.cdnunion.com/

    http://www.kukudm.cdnunion.com/http://www.kukudm.com/对应的CNAME记录.

    1.4 查询域名服务器
    C:\>nslookup -type=ns cdnunion.com
    *** Can't find server name for address 192.168.2.1: Non-existent domain
    *** Default servers are not available
    Server: UnKnown
    Address: 192.168.2.1

    Non-authoritative answer:
    cdnunion.com    nameserver = ns2.cdnunion.com

    ns2.cdnunion.com        internet address = 61.129.102.61

    ns2.cdnunion.com是cdnunion.com域名的DNS服务器.

    2.什么是A记录?什么是别名记录(CNAME)?什么是MX记录?什么是NS记录?

    http://help.zzy.cn/info.asp?id=30

    A (Address) 记录

    是用来指定主机名(或域名)对应的IP地址记录。用户可以将该域名下的网站服务器指向到自己的web server上。同时也可以设置您域名的二级域名。 


    别名记录(CNAME)

    也被称为规范名字。这种记录允许您将多个名字映射到同一台计算机。 通常用于同时提供WWW和MAIL服务的计算机。例如,有一台计算机名为“host.mydomain.com”(A记录)。 它同时提供WWW和MAIL服务,为了便于用户访问服务。可以为该计算机设置两个别名(CNAME):WWW和MAIL。 这两个别名的全称就是“www.mydomain.com”和“mail.mydomain.com”。实际上他们都指向“host.mydomain.com”。 同样的方法可以用于当您拥有多个域名需要指向同一服务器IP,此时您就可以将一个域名做A记录指向服务器IP然后将其他的域名做别名到之前做A记录的域名上,那么当您的服务器IP地址变更时您就可以不必麻烦的一个一个域名更改指向了 只需要更改做A记录的那个域名其他做别名的那些域名的指向也将自动更改到新的IP地址上了。


    MX(Mail Exchanger)记录

    是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据 收信人的地址后缀来定位邮件服务器。例如,当Internet上的某用户要发一封信给 user@mydomain.com 时,该用户的邮件系统通过DNS查找mydomain.com这个域名的MX记录,如果MX记录存在, 用户计算机就将邮件发送到MX记录所指定的邮件服务器上。


    NS(Name Server)记录

    是域名服务器记录,用来指定该域名由哪个DNS服务器来进行解析。


    什么是TTL值?
        TTL值全称是“生存时间(Time To Live)”,简单的说它表示DNS记录在DNS服务器上缓存 时间。要理解TTL值,请先看下面的一个例子:
    假设,有这样一个域名myhost.abc.com(其实,这就是一条DNS记录,通常表示在abc.com域中有一台名为myhost的主机 )对应IP地址为1.1.1.1,它的TTL为10分钟。这个域名或称这条记录存储在一台名为dns.abc.com的DNS服务器上。

    3.域名解析

    http://baike.baidu.com/view/30676.htm

    什么是域名解析?

    域名解析就是域名到IP地址的转换过程。IP地址是网路上标识您站点的数字地址,为了简单好记,采用域名来代替ip地址标识站点地址。域名的解析工作由DNS服务器完成。

  • 相关阅读:
    数据结构【图】—022邻接矩阵的深度和广度遍历
    第一百三十一天 how can I 坚持
    第一百三十天 how can I 坚持
    第一百二十九天 how can I坚持
    第一百二十八天 how can i 坚持
    第一百二十七天 how can I 坚持
    第一百二十六天 how can I 坚持
    第一百二十五天 how can I坚持
    第一百二十四天 how can I坚持
    第一百二十三天 how can I 坚持
  • 原文地址:https://www.cnblogs.com/liuzhendong/p/2195433.html
Copyright © 2011-2022 走看看