문제

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?

code:

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:            {
도움이 되었습니까?

해결책

You should use some managed dns client for that.

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)

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top