Sample code for 30+ languages & platforms
Xbase++ 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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oMailman
LOCAL cEmailAddr
LOCAL oSa
LOCAL oDns
LOCAL oJson
LOCAL i
LOCAL nCount_i
LOCAL cDomain

nSuccess := 0

oMailman := CreateObject("Chilkat.MailMan")

//  ...
//  ...

cEmailAddr := "joe@example.com"

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

oSa := oMailman:MxLookupAll(cEmailAddr)
IF (oMailman:LastMethodSuccess == 0)
    ? oMailman:LastErrorText
    oMailman:destroy()
    RETURN
ENDIF

//  ...
//  ...

oSa:destroy()

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

oDns := CreateObject("Chilkat.Dns")

oJson := CreateObject("Chilkat.JsonObject")

//  This gets all MX domains for an email address.  (Typically one domain.)
//  The preferred domain will be at index 0 (see below).
nSuccess := oDns:Query("MX", cEmailAddr, oJson)
IF (nSuccess == 0)
    ? oDns:LastErrorText
    oMailman:destroy()
    oDns:destroy()
    oJson:destroy()
    RETURN
ENDIF

i := 0
nCount_i := oJson:SizeOfArray("answer.mx")
DO WHILE i < nCount_i
    oJson:I := i
    cDomain := oJson:StringOf("answer.mx[i].domain")
    ? cDomain
    i := i + 1
ENDDO

oMailman:destroy()
oDns:destroy()
oJson:destroy()