![]() |
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.MxLookup to Dns.QueryProvides instructions for replacing deprecated MxLookup method calls with the Chilkat Dns class. Note: This example requires Chilkat v11.0.0 or greater.
IncludeFile "CkJsonObject.pb" IncludeFile "CkDns.pb" IncludeFile "CkMailMan.pb" Procedure ChilkatExample() mailman.i = CkMailMan::ckCreate() If mailman.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; ... ; ... emailAddr.s = "joe@example.com" ; ------------------------------------------------------------------------ ; The MxLookup method is deprecated: domain.s = CkMailMan::ckMxLookup(mailman,emailAddr) If CkMailMan::ckLastMethodSuccess(mailman) = 0 Debug CkMailMan::ckLastErrorText(mailman) CkMailMan::ckDispose(mailman) ProcedureReturn EndIf ; ------------------------------------------------------------------------ ; 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 = 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.