![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) Transition from MailMan.MxLookupAll to the Chilkat DNS classProvides instructions for replacing deprecated MxLookupAll method calls with the Chilkat Dns class. Note: This example requires Chilkat v11.0.0 or greater.
IncludeFile "CkMailMan.pb" IncludeFile "CkJsonObject.pb" IncludeFile "CkDns.pb" IncludeFile "CkStringArray.pb" Procedure ChilkatExample() mailman.i = CkMailMan::ckCreate() If mailman.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; ... ; ... emailAddr.s = "joe@example.com" ; ------------------------------------------------------------------------ ; The MxLookupAll method is deprecated: sa.i = CkMailMan::ckMxLookupAll(mailman,emailAddr) If CkMailMan::ckLastMethodSuccess(mailman) = 0 Debug CkMailMan::ckLastErrorText(mailman) CkMailMan::ckDispose(mailman) ProcedureReturn EndIf ; ... ; ... CkStringArray::ckDispose(sa) ; ------------------------------------------------------------------------ ; Do the equivalent using the Chilkat DNS class dns.i = CkDns::ckCreate() If dns.i = 0 Debug "Failed to create object." ProcedureReturn EndIf json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; This gets all MX domains for an email address. (Typically one domain.) ; The preferred domain will be at index 0 (see below). success.i = CkDns::ckQuery(dns,"MX",emailAddr,json) If success = 0 Debug CkDns::ckLastErrorText(dns) CkMailMan::ckDispose(mailman) CkDns::ckDispose(dns) CkJsonObject::ckDispose(json) ProcedureReturn EndIf i.i = 0 count_i.i = CkJsonObject::ckSizeOfArray(json,"answer.mx") While i < count_i CkJsonObject::setCkI(json, i) domain.s = CkJsonObject::ckStringOf(json,"answer.mx[i].domain") Debug domain i = i + 1 Wend CkMailMan::ckDispose(mailman) CkDns::ckDispose(dns) CkJsonObject::ckDispose(json) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.