Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I send an e-mail to, 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, but I want to know what records would be used exactly.

I can send e-mail successfully to one of my domains,, 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?

share|improve this question
There are two questions here. Using a different mail server is as simple as setting up another account or changing the mail server of the existing account. Mail clients' behavior differs wildly. Perhaps you can tell us what mail clients you are using, and if you have control over your DNS service. – kmarsh Jan 27 '14 at 15:17

If there is no MX record, an A record is used as a fallback. To achieve what you want, simply set the MX record to your desired destination.

share|improve this answer
Thanks - I was hoping it would be something simple like that :) – Gus Jan 27 '14 at 14:46

The answer is in RFC 5321

The lookup first attempts to locate an MX record associated with the name. If a CNAME record is found, the resulting name is processed as if it were the initial name. If a non-existent domain error is returned, this situation MUST be reported as an error. If a temporary error is returned, the message MUST be queued and retried later (see Section If an empty list of MXs is returned, the address is treated as if it was associated with an implicit MX RR, with a preference of 0, pointing to that host. If MX records are present, but none of them are usable, or the implicit MX is unusable, this situation MUST be reported as an error.

To make it a bit more human-readable, and assuming the domain

  1. Mailserver asks for an MX-record for

  2. 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 is acting MX record with lowest preference. Remember this for step 3.

  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.

share|improve this answer

First, your client does no DNS lookups. All the lookups are done on the MTA.

The MX record is the preferred DNS record in these cases, but as you stated an A record can stand in its place if no MX records are found (don't count on that being supported by everyone), and if you have no MX record it's very likely that mail from your MTA will be rejected.

share|improve this answer
If using an A record isn't supported, then the sending MTA is broken and should be taken out and shot. – Jenny D Jan 27 '14 at 14:59
Oh I agree, but I've dealt with remote MTAs who thought 450 == 550, and worse.. – NickW Jan 27 '14 at 15:04
So have I... So let me rephrase that. "the MTA should be set on fire and shown around the world as a warning to programmers to read the RFC first". – Jenny D Jan 27 '14 at 15:10
You're my kind of sysadmin :) – NickW Jan 27 '14 at 15:12
I did email sysadmin/postmaster duty at an ISP for 7 years. I may or may not have some remaining issues :-) – Jenny D Jan 27 '14 at 15:13

Your Answer


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.