MX record error

I'm a managed code guy, so when I talk to unmanaged code and it doesn't work as advertised, I get jittery. Can someone explain to me why this will return without MX records when command line is running nslookup

?

[DllImport("dnsapi", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
private static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string pszName, QueryTypes wType, QueryOptions options, int aipServers, ref IntPtr ppQueryResults, int pReserved);

string domain = "HomeTechnologySolutions.com";
int num1 = DnsQuery(ref domain, QueryTypes.DNS_TYPE_MX, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ref ptr1, 0);
if (num1 != 0)
{
    throw new Win32Exception(num1)
}

      

The returned error code means "No records were found for the specified DNS query."

Punch in the pants is the first domain I found that failed this test, but I'm told it happens "OFTEN". (nobody can define me for me, but I'm working on it)

Anyway, when I do nslookup via the command line, I get back:

> set type=mx
> hometechnologysolutions.com
Server:  dhcp.removedtoprotectedtheguilty.com
Address:  10.0.0.9

hometechnologysolutions.com
        primary name server = ns1.streetsimple.com
        responsible mail addr = hostmaster.streetsimple.com
        serial  = 11
        refresh = 900 (15 mins)
        retry   = 600 (10 mins)
        expire  = 86400 (1 day)
        default TTL = 3600 (1 hour)

      

0


source to share


1 answer


I am not getting any records MX

returned for the given domain name when you can also use "dig".

The 'nslookup' results you specify are in the domain record SOA

and do not contain any records MX

. The record is SOA

returned in the "permissions" section of the DNS response, even if there are no records for the specific question you asked.



In the absence of entries MX

, Mail Transfer Agents (MTAs) will treat the entry A

for the host as a MX

priority 0 entry and instead try to make an SMTP connection to that address.

See section 5.1 RFC 5321 . Note that although this is a very recent RFC, this behavior also existed in previous versions of the SMTP specification.

+3


source







All Articles