mx which stands for mail exchange is just one of many dns record types the primary purpose of mx records is to direct email to a mail server when you send an email to bob example.com how does the message know where to go we can look up the a record for example.com but this tells us where the website is hosted that is not necessarily the same server as where the mail is handled this is where mx records are necessary an mx record looks similar to other dns records and has a name time to live and a
value the major difference is the priority field which sometimes is combined with the value field mail will be sent to the record with the lowest priority if there are multiple records with the same priority then mail will flow evenly between the servers in a load balanced fashion when you have multiple priority values the lowest priority server will be used when this server is overwhelmed or goes offline then the next highest priority server will be used this backup configuration can either continue delivering mail if it has access to the mailboxes or cue the mail until the
primary server comes back online without this redundancy in place the sending server can retry sending until the destination server comes back online but this is not ideal and the message might never get delivered priority values for mx records can be any integer as small as zero at least for google domains the largest priority value that they accept is 2 to the power of 32 whereas namecheap goes up to 255 so it just depends because they are relative having three mail servers with priority of 10 20 and 30 is equivalent to having priorities of one two
and three and is even equivalent to something like 42 137 845 in each of these cases email will be sent to the server with the smallest priority value first when creating an mx record in google domains simply choose mx for the type pick a time to live that makes sense for you leave the host name blank and then type in a priority followed by the mail server's domain if you have multiple mail servers you can also add another value similarly for namecheap enter the at symbol for the default domain name the mail server's domain name
and then the priority value the value of an mx record must point to an a record and cannot point to a cname record you can use the dig command to look up these values with dig a domain name followed by mx and here you will see that my email uses gmail servers the same information can be found online with a tool like mxtoolbox.com or dnschecker.org i have a bunch of explainer videos on other dns record types right here so check that out and i will see you over there [Music] you