【问题标题】:MX validation for mail邮件的 MX 验证
【发布时间】:2011-12-08 19:49:58
【问题描述】:

我尝试使用此 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]))...

错误:

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:            {

【问题讨论】:

标签: c# email dns mx-record


【解决方案1】:

您应该为此使用一些托管 dns 客户端。

在验证 MX 记录时... MX 是每个 SMTP 标准的可选记录。 如果没有 MX 记录,则使用 A reord 代替。 (可能你知道,但万一我注意到了)

有 dnsquery.zip 示例,显示查询不同记录的内容: http://www.lumisoft.ee/lsWWW/download/downloads/Examples/

【讨论】:

    猜你喜欢
    • 2010-12-12
    • 2011-05-11
    • 2018-04-26
    • 2016-06-26
    • 2012-04-07
    • 2016-11-18
    • 2010-11-09
    • 2019-03-12
    • 2020-11-08
    相关资源
    最近更新 更多