SeekfordSolutions.DNSMXWizard Class Library

MailExchangeData Class

MailExchangeData Members

A MailExchange specific data record used in ResourceRecord.Data

        [C#]
        public class MailExchangeData : Object
      

Remarks

Mail Exchange Record. Creates a mail route for a domain name. A domain name can have multiple mail routes, each assigned a priority number. The mail route with the lowest number identifies the server responsible for the domain. Other mail servers listed will be used as backups.

The MailExchangeData class encapsulates this information for easy access and use.

Example

The following code example queries a DNS server and obtains the MX records for a domain

using System; 
using SeekfordSolutions.DNSMXWizard;

public class MyClass {

    public static void Main() 
    {
		DNSClient myDNSClient = new DNSClient("Serial Number");
		ArrayList myDNSServers = new ArrayList();
		myDNSServers = myDNSClient.GetSystemDNSServers();
		myDNSClient.SetServers(myDNSServers);
		Console.WriteLine("Performing MX Lookup");
		MailExchangeData MXData;
		ArrayList myMXList;
		try
		{			
			myMXList = myDNSClient.MailExchangeLookup("www.SeekfordSolutions.com");
			Console.WriteLine("MX Lookup results:\r\nServer\tPreference\r\n");
			for(int iX=0; iX < myMXList.Count;iX++)
			{
				MXData = (MailExchangeData)myMXList[iX];
				Console.WriteLine(MXData.Server.ToString() + "\t" + MXData.Priority.ToString() + "\r\n"); 
			}
		}
		catch(Exception err)
		{
			Console.WriteLine(err.Message.ToString());				
		}
		
    }
}

/*
	
This code produces the following output:
Performing MX Lookup
MX Lookup results:
Server	Preference
64.89.8.154	10

*/

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family

See Also

DNSMXWizard Namespace