Lianja
Lianja
Transition from MailMan.MxLookup to Dns.Query
Provides instructions for replacing deprecated MxLookup method calls with the Chilkat Dns class.Chilkat Lianja Downloads
llSuccess = .F.
loMailman = createobject("CkMailMan")
// ...
// ...
lcEmailAddr = "joe@example.com"
// ------------------------------------------------------------------------
// The MxLookup method is deprecated:
lcDomain = loMailman.MxLookup(lcEmailAddr)
if (loMailman.LastMethodSuccess = .F.) then
? loMailman.LastErrorText
release loMailman
return
endif
// ------------------------------------------------------------------------
// 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