MX验证邮件 [英] MX validation for mail

查看:309
本文介绍了MX验证邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用此DLL: http://www.eggheadcafe.com/articles/20050129 .asp 但不工作。我总是在运行时得到超时。任何人知道任何好的dll或C#示例如何检查DNS MX是否存在邮件?

I try to use this dll: http://www.eggheadcafe.com/articles/20050129.asp but not working. i always get timeout when running it. Anyone know any good dll or C# example how to check if DNS MX for mail exist?

代码:

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]))...

错误: /应用程序中的服务器错误,p>

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


推荐答案

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

You should use some managed dns client for that.

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

Also when validating MX record ... MX is optional record per SMTP standard. If no MX record, A reord is used instead. (Probably you know it, but in case i noted it out)

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

There is dnsquery.zip example, what shows show to query different records: http://www.lumisoft.ee/lsWWW/download/downloads/Examples/

这篇关于MX验证邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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