Sample code for 30+ languages & platforms
Lianja Requires Chilkat v11.0.0+

Transition from MailMan.MxLookupAll to the Chilkat DNS class

Provides instructions for replacing deprecated MxLookupAll method calls with the Chilkat Dns class.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loMailman = createobject("CkMailMan")

//  ...
//  ...

lcEmailAddr = "joe@example.com"

//  ------------------------------------------------------------------------
//  The MxLookupAll method is deprecated:

loSa = loMailman.MxLookupAll(lcEmailAddr)
if (loMailman.LastMethodSuccess = .F.) then
    ? loMailman.LastErrorText
    release loMailman
    return
endif

//  ...
//  ...

release loSa

//  ------------------------------------------------------------------------
//  Do the equivalent using the Chilkat DNS class

loDns = createobject("CkDns")

loJson = createobject("CkJsonObject")

//  This gets all MX domains for an email address.  (Typically one domain.)
//  The preferred domain will be at index 0 (see below).
llSuccess = loDns.Query("MX",lcEmailAddr,loJson)
if (llSuccess = .F.) then
    ? loDns.LastErrorText
    release loMailman
    release loDns
    release loJson
    return
endif

i = 0
lnCount_i = loJson.SizeOfArray("answer.mx")
do while i < lnCount_i
    loJson.I = i
    lcDomain = loJson.StringOf("answer.mx[i].domain")
    ? lcDomain
    i = i + 1
enddo


release loMailman
release loDns
release loJson