SocketTools .NET Edition

DnsClient.MailExchanges Property

Return the number of mail exchange records for the specified host.

[Visual Basic]
Public ReadOnly Property MailExchanges As Integer
[C#]
public int MailExchanges {get;}

Property Value

An integer value. A value of zero specifies that there are no mail exchange records for the host.

Remarks

The MailExchanges property returns the number of mail exchange (MX) records for the current host specified by the HostName property. This property can be used in conjunction with the MailExchange array to enumerate the servers responsible for accepting mail for a given domain.

Example

The following example populates a ListBox control with the host names of those servers responsible for accepting e-mail for the specified domain:

[Visual Basic]
Dim nIndex As Integer
 
ListBox1.Items.Clear()
dnsClient.HostName = strHostName
 
For nIndex = 0 To dnsClient.MailExchanges - 1
    ListBox1.Items.Add(dnsClient.MailExchange(nIndex))
Next
    

See Also

DnsClient Class | SocketTools Namespace | MailExchange Field