MX Records, also known as Mail Exchanger records, are specific DNS (Domain Name
System) records that deal with Mail Servers. Every mail server, that is publicly
available to accept email, needs a special DNS record called Mail Exchanger records.
These records point to specific domain name addresses or IP addresses, that are
meant to receive email. When you send an email to someone@microsoft.com, your mail
server looks up the domain microsoft.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. server connects up to the address
with the highest priority (the lowest numerical number) and sends an email to someone@microsoft.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 microsoft.com
microsoft.com MX preference = 10, mail exchanger = maila.microsoft.com
microsoft.com MX preference = 10, mail exchanger = mailb.microsoft.com
microsoft.com MX preference = 10, mail exchanger = mailc.microsoft.com
In this example, all of Microsoft's mail servers are weighted equally (10), thus
your mail server will make its own determination which mail server it wants to
connect to first.
Using Email Validator to get MX Records
Here are two quick code snippets to determine the MX Records of a domain:
[C#]
using System;
using Neev Software .ASPNET.Components;
namespace csTest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
string domainName = "microsoft.com";
EmailAddressValidator ev = new EmailAddressValidator();
MXRecordList records = ev.GetMXRecords( domainName );
foreach( MXRecord record in records)
{
//MXRecord.ToString() is an overloaded method that returns Priority:MailExchanger
Console.WriteLine( record.ToString() );
}
Console.ReadLine();
}
}
}
[Visual
Basic]
Imports Neev Software.ASPNET.Components
Module Module1
Sub Main()
Dim domainName As String = "microsoft.com"
Dim ev As New EmailAddressValidator ()
Dim records As MXRecordList () = ev.GetMXRecords( domainName )
Dim record As MXRecord
For Each record In records
'MXRecord.ToString() is an overloaded method that returns Priority:MailExchanger
Console.WriteLine(record.ToString())
Next record
Console.ReadLine()
End Sub
End Module
See
Also