PowerBuilder
PowerBuilder
Transition from MailMan.MxLookupAll to the Chilkat DNS class
Provides instructions for replacing deprecated MxLookupAll method calls with the Chilkat Dns class.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mailman
string ls_EmailAddr
oleobject loo_Sa
oleobject loo_Dns
oleobject loo_Json
integer i
integer li_Count_i
string ls_Domain
li_Success = 0
loo_Mailman = create oleobject
li_rc = loo_Mailman.ConnectToNewObject("Chilkat.MailMan")
if li_rc < 0 then
destroy loo_Mailman
MessageBox("Error","Connecting to COM object failed")
return
end if
// ...
// ...
ls_EmailAddr = "joe@example.com"
// ------------------------------------------------------------------------
// The MxLookupAll method is deprecated:
loo_Sa = loo_Mailman.MxLookupAll(ls_EmailAddr)
if loo_Mailman.LastMethodSuccess = 0 then
Write-Debug loo_Mailman.LastErrorText
destroy loo_Mailman
return
end if
// ...
// ...
destroy loo_Sa
// ------------------------------------------------------------------------
// Do the equivalent using the Chilkat DNS class
loo_Dns = create oleobject
li_rc = loo_Dns.ConnectToNewObject("Chilkat.Dns")
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
// This gets all MX domains for an email address. (Typically one domain.)
// The preferred domain will be at index 0 (see below).
li_Success = loo_Dns.Query("MX",ls_EmailAddr,loo_Json)
if li_Success = 0 then
Write-Debug loo_Dns.LastErrorText
destroy loo_Mailman
destroy loo_Dns
destroy loo_Json
return
end if
i = 0
li_Count_i = loo_Json.SizeOfArray("answer.mx")
do while i < li_Count_i
loo_Json.I = i
ls_Domain = loo_Json.StringOf("answer.mx[i].domain")
Write-Debug ls_Domain
i = i + 1
loop
destroy loo_Mailman
destroy loo_Dns
destroy loo_Json