MX Resource Record

from Wikipedia, the free encyclopedia

An MX Resource Record (English MX entry, actually Mail Exchange Resource Record , MX-RR) of a domain is a resource record in the Domain Name System , which relates exclusively to the e-mail service .

An MX record states under which fully qualified domain name (FQDN) the mail server for a domain or subdomain can be reached. It is common to define several MX records for a domain with different priorities so that if one mail server fails, another can receive the e-mails. This increases the likelihood that a mail can still be delivered to the recipient domain.
Finally, this procedure enables individual (physically separated) mail servers to be taken offline for maintenance work without endangering the receipt of mail.

When sending an e-mail, the outgoing mail server first queries the MX-RR of the domain (the part of the e-mail address after the "@") to which the recipient address is assigned. As a rule, there is at least one MX-RR for each domain (including sub-domains). The outgoing server then establishes an SMTP connection with the first listed mail server of the incoming domain. If there is no MX-RR, the mail server tries to determine the A resource record (the IP address ) of the domain. If the DNS returns an IP address to this request, the mail server tries to establish an SMTP connection to this IP address . If this does not work either, it reports an error (host unknown).

If an MX-RR is available, it sends the e-mail to the mail server, which is noted there. If there are several MX-RRs, the e-mail is sent to the mail server with the lowest priority ("preference"). Therefore, this value is often referred to as distance. If this cannot be reached, the mail server tries to reach the next mail server in the MX list, etc. This makes it relatively easy to compensate for the failure of a mail server.

construction

domain
for which the entry is
class
IN ( Internet )
Type
MX (Mail Exchange) list
priority
Specifies the priority of the entry (entries with lower values ​​are preferred)
Mail server
Name of the mail server

example

If a mail is to be sent to <[email protected]> , the sender's mail server first checks the MX record of wikipedia.org . He is given the following mail server:

wikipedia.org preference = 10, mail exchanger = mchenry.wikimedia.org
wikipedia.org preference = 50, mail exchanger = lists.wikimedia.org

Now he asks about the AAAA record and the A record of the server with the highest priority (i.e. the lowest number) in order to obtain the associated IP address. He receives the following information:

mchenry.wikimedia.org internet address = 208.80.152.186
mchenry.wikimedia.org AAAA IPv6 address = 2620:0:860:2:219:b9ff:fedd:c027

At this address he tries to deliver the message; if this fails, he then tries the alternative lists.wikimedia.org .

Manual review of MX records

Mail servers normally make corresponding DNS queries for MX records when sending e-mails.

MX records can be queried manually using DNS query tools. However, since these usually only query A records by default, the query type must be specified explicitly in this case.

Windows / Unix (including Mac OS X)

Under Microsoft Windows , Unix and Mac OS X , an MX record can be queried with the supplied command line tool nslookup . The type is set with set type=MX.

nslookup
> set type=MX
> wikipedia.org
Server:  verwendeter Nameserver, aufgelöster Name
Address:  verwendeter Nameserver, IP-Adresse
Nicht-autorisierende Antwort:
wikipedia.org MX preference = 10, mail exchanger = mchenry.wikimedia.org
wikipedia.org MX preference = 50, mail exchanger = lists.wikimedia.org
mchenry.wikimedia.org internet address = 208.80.152.186
mchenry.wikimedia.org AAAA IPv6 address = 2620:0:860:2:219:b9ff:fedd:c027
lists.wikimedia.org internet address = 208.80.154.4
> exit

Unix Extended

Under Unix and Linux derivatives, there are various ways of querying MX records. The dig program returns the full response from the DNS server:

 $ dig -t MX wikipedia.org

 ; <<>> DiG 9.4.2 <<>> -t MX wikipedia.org
 ;; global options:  printcmd
 ;; Got answer:
 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61573
 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2

 ;; QUESTION SECTION:
 ;wikipedia.org.                 IN      MX

 ;; ANSWER SECTION:
 wikipedia.org.          2481    IN      MX      10 mchenry.wikimedia.org.
 wikipedia.org.          2481    IN      MX      50 lists.wikimedia.org.

 ;; ADDITIONAL SECTION:
 mchenry.wikimedia.org.  2164    IN      A       208.80.152.186
 lists.wikimedia.org.    2164    IN      A       91.198.174.5
 lists.wikimedia.org.    550     IN      AAAA    2620:0:862:1::25:1
 ...

 $

A quick query is also possible with the host program :

$ host wikipedia.org
wikipedia.org has address 208.80.152.2
wikipedia.org mail is handled by 50 lists.wikimedia.org.
wikipedia.org mail is handled by 10 mchenry.wikimedia.org.
$

Queries can also be made interactively with the nslookup program.

$ nslookup <<EOT
> set type=MX
> wikipedia.org
> EOT
Server:  verwendeter Nameserver, aufgelöster Name
Address:  verwendeter Nameserver, IP-Adresse
Nicht autorisierte Antwort:
wikipedia.org MX preference = 10, mail exchanger = mchenry.wikimedia.org
wikipedia.org MX preference = 50, mail exchanger = lists.wikimedia.org
mchenry.wikimedia.org internet address = 208.80.152.186
lists.wikimedia.org internet address = 91.198.174.5
lists.wikimedia.org has AAAA address 2620:0:862:1::25:1
$

In non-interactive mode, the query is:

$ nslookup -querytype=MX wikipedia.org
...
$

Reverse MX Record

Reverse MX RRs are a special form of MX RRs. These are the domain name system entries of the sending mail server. These entries are z. B. used in the Sender Policy Framework Technology.

Priority and Preference

The mail server with the highest priority is the one with the lowest preference value.

One method popular with spammers is to connect to the mail server that is given in the MX list with the lowest priority (the one with the highest numerical value). This is intended to bypass spam filters that run on the mail server with the highest priority.

Web links

  • RFC 974 - Mail Routing and the Domain System (obsolete)
  • RFC 2821 - Simple Mail Transfer Protocol (obsolete)
  • RFC 5321 - Simple Mail Transfer Protocol
  • RFC 7505 - A "Null MX" No Service Resource Record for Domains That Accept No Mail
  • Other Trick For Blocking Spam - Instructions: Fake MX Record to Block Spam