ComponentPro UltimateEmailValidator

      Getting Mail Exchange Records

      Language Filter: AllSend comments on this topic to ComponentPro

      An MX Record or Main eXange Record is a type of resource in the Domain Name System (DNS) specifying how Internet email should be routed. MX Records point to the servers that should receive an email, and their priority relative to each other. When you send an email to someone@adomain.com, your mail server looks up the domain adomain.com, and asks for the MX records (the addresses that accept email). The DNS servers will return the records.  Each MX record has a priority and an address associated with it. Your mail server then connects up to the address with the highest priority (the lowest numerical number) and send an email to someone@adomain.com. If the connection fails, your mail server should then attempt to connect to the next server.  As an example, here are the associated MX records for the domain adomain.com

      adomain.com MX preference = 10, mail exchanger = maila.adomain.com
      adomain.com MX preference = 10, mail exchanger = mailb.adomain.com
      adomain.com MX preference = 10, mail exchanger = mailc.adomain.com

      In this example, all of adomain's mail servers are weighted equally (10), thus your mail server will make it's own determination which mail server it wants to connect to first.

      You can pass you Domain Name as a parameter for the function GetMailExchangeRecords  to receive corresponding MX Records for the given DNS.

      An example below shows you how to retrieve MX Records from hotmail.com:

      Source Code

      using System;
      using ComponentPro.Net;
      
      ...
      
      // Create a new instance of the EmailValidator class.
      EmailValidator em = new EmailValidator();
      // Retrieve MX information.
      MailExchangeRecord[] records = em.GetMailExchangeRecords("hotmail.com");
      
      // Print out. 
      foreach (MailExchangeRecord record in records)
      {
          Console.WriteLine(record.ToString());
      }