我尝试使用此dll:http://www.eggheadcafe.com/articles/20050129.asp但不能正常工作。运行时总是会超时。任何人都知道任何好的DLL或C#示例如何检查邮件的DNS MX是否存在?
代码:
private static bool CheckDnsEntry(string domain)
{
string[] dnsServer = DnsMx.GetMXRecords(domain);
if (dnsServer.Length > 0)
{
return true;
}
return false;
}
string[] emailparts = email.Split('@');
if (CheckDnsEntry(emailparts[1]))...
ERROR:
Server Error in '/' Application.
Connection timeout
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: Connection timeout
Source Error:
Line 462: private static bool CheckDnsEntry(string domain)
Line 463: {
Line 464: string[] dnsServer = DnsMx.GetMXRecords(domain);
Line 465: if (dnsServer.Length > 0)
Line 466: {
答案 0 :(得分:1)
您应该使用一些托管的DNS客户端。
同样在验证MX记录时... MX是每个SMTP标准的可选记录。 如果没有MX记录,则使用A reord。 (可能你知道,但如果我注意到了)
有dnsquery.zip示例,显示show来查询不同的记录: http://www.lumisoft.ee/lsWWW/download/downloads/Examples/