Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What happens if you have 2 DNS entries:

Name         |  Type |  Value
-------------+-------+--------------
example.com  |  A    |  20.20.20.20
example.com  |  MX   |  mail.example.com

Does this mean that smtp requests to example.com will map to 20.20.20.20, and somehow request in the headers mail.example.com? What?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

A Mail Transfer Agent will request the MX DNS entries for the receiving domain (example.com) and determine the record with the lowest distance (priority or preference) (mail.example.com, although no preference is given in your example) and will look up the corresponding IP address for that record. The MTA will connect to the IP address returned by the DNS server to deliver the e-mail.

In your example you are missing a A record for mail.example.com and a preference for the MX record, but the notation of the preference depends on the used DNS software.

Name             |  Type |  Value
-----------------+-------+--------------
example.com      |  A    |  20.20.20.20
example.com      |  MX   |  10 mail.example.com
mail.example.com |  A    |  20.20.20.20
share|improve this answer
1  
Worth noting that the record that the MX points to should ALWAYS be an A record, not a CNAME, because some poor, older MTAs will get stuck in a loop if an MX points to a CNAME. –  Mark Henderson May 11 '10 at 22:50
    
Good point Farseeker. An additional AAAA (IPv6) record is also possible. –  PowerSp00n May 11 '10 at 22:55
    
Also a lookup on 20.20.20.20 should return mail.example.com. –  BillThor May 12 '10 at 2:38
    
Just for the heck of it, also note that an MX record is not required. If there's no MX record, the sending MTA will look for a domain A record, and if it finds one, will send email to the ip address that the domain A record points to. –  joeqwerty May 12 '10 at 3:32
    
So the mail.example.com A record is not required? –  bobobobo May 12 '10 at 3:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.