If I send an e-mail to gus@example.com, how does my e-mail client find out what IP address to send the e-mail to? I understand it would do a DNS lookup for example.com, but I want to know what records would be used exactly.
I can send e-mail successfully to one of my domains, gus@echochess.com, and there are no MX records. I am assuming it is using the A record here, but what if I wanted to have a different mail server handle emails, with a different IP?
Best Answer
The answer is in RFC 5321
To make it a bit more human-readable, and assuming the domain
example.com
:Mailserver asks for an MX-record for
example.com
a. If there is one or more MX-records, choose the one with the lowest preference. Remember this for step 3.
b. If there isn't one, ddecide that
example.com
is acting MX record with lowest preference. Remember this for step 3.Resolve the MX record to its matching A record and contact that host
So as long as you don't have a specific MX record, your A record will be used as an MX record. Once you do setup an MX record, that one will be used instead.