Sample code for 30+ languages & platforms
VB.NET

Transition from MailMan.MxLookupAll to the Chilkat DNS class

Provides instructions for replacing deprecated MxLookupAll method calls with the Chilkat Dns class.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim mailman As New Chilkat.MailMan

' ...
' ...

Dim emailAddr As String = "joe@example.com"

' ------------------------------------------------------------------------
' The MxLookupAll method is deprecated:

Dim sa As Chilkat.StringArray = mailman.MxLookupAll(emailAddr)
If (mailman.LastMethodSuccess = False) Then
    Debug.WriteLine(mailman.LastErrorText)
    Exit Sub
End If


' ...
' ...



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

Dim dns As New Chilkat.Dns

Dim json As New Chilkat.JsonObject

' This gets all MX domains for an email address.  (Typically one domain.)
' The preferred domain will be at index 0 (see below).
success = dns.Query("MX",emailAddr,json)
If (success = False) Then
    Debug.WriteLine(dns.LastErrorText)
    Exit Sub
End If


Dim i As Integer = 0
Dim count_i As Integer = json.SizeOfArray("answer.mx")
While i < count_i
    json.I = i
    Dim domain As String = json.StringOf("answer.mx[i].domain")
    Debug.WriteLine(domain)
    i = i + 1
End While