DNS lookup for MX record

I thought NetTalks new NetDNS was used for DNS lookups, but it seems to be a client for DNS registrars instead - is there any recommended way to query a domain name for it’s MX record?

Reference NetTalk: NetTalk DNS

Thanks, but how do I implement this in Clarion?
I’ve found the following but it’s a bit hard to follow:

Dnsapi.zip (1,9 KB)

I’ve got it working with the above implementation - the lib refers to the Dnsapi.dll in the Windows\System32 folder which contains the required functions.

Add the contents of the zip to your project, simply include the .inc file in the global includes and then create an instance of Win32DNS class and use the Lookup of one of it’s version to do a DNS call

2 Likes

Hi Dylan - Looks like a cool solution.

FWIW, on line 36, you have this:

        searchName = LEFT(CLIP(host));

it should read as

        searchName = CLIP(LEFT(host));

Otherwise, you would end up with trailing spaces if there were, in fact, space(s) passed in front of the host name. e.g. " hostname.com" would become "hostname.com "

Oh thank you - I came across that combination here in the forums - thanks for the headsup - I am not at my laptop so can’t quickly change the zip contents

1 Like

A git repo or gist would be cool too.

@jslarve of what? I shared the code - except a fully working app that is

What’s nice about using a gist or repo is that you still have control over the original, and just post updates to it (such as fixing bugs or adding features).

For example, here’s one of Carl’s gists. You can see that there are 7 revisions, etc. You can add multiple files to a gist.