Messaging Fundamentals Series

✉️ Understanding Email Migration to M365 from a "Top 1%" Perspective — What "Domain" Means for Email, and What Exchange Server Actually Is

Introduction

This article is part of the Top 1% Series’ full article guide, and the first article in a new series on messaging fundamentals. It assumes you understand general DNS mechanics (particularly MX records) from Understanding How DNS Works from a “Top 1%” Perspective.

Prerequisites

Getting the Big Picture

What “Domain” Means for Email: A Namespace Tied Together via the MX Record

The example.com part of the email address user@example.com is the same domain name, existing in the same DNS zone, as the example.com in a website’s https://example.com. Even though the two share the same name, which server actual traffic reaches is decided by separate DNS records for each. Access to a website goes (in most cases) to a specific IP address via an A record, while mail delivery is directed, via an MX record, to the hostname of the mail server responsible for receiving mail addressed to that domain.

graph TB
    Domain["The domain name example.com (shared)"]
    Domain -->|"A record"| Web["The website's server<br/>(e.g., 203.0.113.10)"]
    Domain -->|"MX record"| Mail["The server that receives mail<br/>(e.g., mail.example.com)"]

Fundamentals, Explained Thoroughly

How MX Records Work: Redundancy via Priority

An MX record doesn’t just specify a single mail server — it can specify multiple mail servers, each with a priority (lower numbers are higher priority). The sending mail server first tries delivering to the highest-priority (lowest-numbered) server, and tries the next-priority server if there’s no response. This is how mail server redundancy is achieved.

Sender authentication mechanisms (SPF, DKIM, DMARC)

The email world has several mechanisms, using DNS’s TXT record, as countermeasures against spoofed mail impersonating a sender domain. SPF publishes, as a TXT record, “the list of IP addresses of servers allowed to send mail from this domain.” DKIM publishes, also as a TXT record, “a digital signature attached to the mail, and the public key used to verify it.” DMARC specifies a policy, based on the SPF/DKIM verification results, for how to handle mail that fails authentication (reject it, quarantine it, and so on). All of these are mechanisms for verifying the legitimacy of the sender, separate from mail delivery itself (the MX record).

The Two Roles an Exchange Server Handles

Exchange server (Microsoft Exchange Server) is a server product from Microsoft that integrates mail, calendar, and contacts management. Its role broadly splits into two:

An on-premises Exchange Server is closely tied to Active Directory, associating an AD user account with an Exchange mailbox to manage it. The AD DS schema, covered in Understanding the Difference Between AD and DC, and Domains vs. Forests, from a “Top 1%” Perspective, gets extended with mailbox-related attributes when Exchange Server is deployed.

What Migrating to M365 (Exchange Online) Concretely Switches Over

Migrating mail to M365 (Microsoft 365) is the work of moving the two functions previously handled by an on-premises Exchange Server — “mail relaying” and “mailbox storage” — to Exchange Online, a cloud-hosted platform Microsoft operates. In practice, this migration involves the following main elements:

  1. Migrating existing mailbox data: Copying each user’s mail, calendar, and contacts data from the on-premises Exchange Server to Exchange Online.
  2. Switching the MX record: Once the migration completes, rewriting the MX record — pointing to the server that receives mail addressed to that domain — from the on-premises Exchange Server to the Exchange Online address. From this switch onward, newly arriving mail gets received on the Exchange Online side.
  3. The option of a hybrid configuration: If you want to migrate in stages, or need to keep some mailboxes on-premises for some reason (such as a compliance requirement), you can choose a “hybrid configuration”, letting the on-premises Exchange Server and Exchange Online coexist for a period. In this configuration, mailboxes on both the on-premises and cloud sides can mutually handle mail delivery and calendar free/busy lookups, as if they were a single organization’s mail system.
graph LR
    subgraph Before["Before migration"]
        MxOld["MX record → on-premises Exchange"]
    end
    subgraph After["After migration"]
        MxNew["MX record → Exchange Online"]
    end
    Before -->|"Switch the MX record once data migration completes"| After

The View From the Top 1% Perspective

TTL Management When Switching the MX Record

As covered in Understanding How DNS Works from a “Top 1%” Perspective, a DNS record has a caching validity period called TTL (Time To Live). If you’re planning to switch an MX record, it’s practical convention to set that record’s TTL short ahead of time. If the TTL stays long, some senders may keep referencing a cached, stale MX record (the on-premises one) even after the switch, causing mail to keep arriving on the on-premises side — a source of confusion.

Typical Reasons a Hybrid Configuration Becomes Necessary

Typical reasons you can’t (or don’t want to) migrate every mailbox at once include constraints on time and bandwidth when migrating a large number of mailboxes at once, and needing to keep some mailboxes on-premises due to a specific business or compliance requirement. A hybrid configuration is a realistic option for achieving this kind of staged migration, or a permanent coexistence configuration.

Common Misconceptions and Pitfalls

The Troubleshooting Perspective

For email-related issues, the basic approach is to isolate whether the problem is with delivery (the MX record/SMTP), or with sender authentication (SPF/DKIM/DMARC).

  1. Mail keeps arriving at the old (on-premises) server even after switching the MX record: The sender’s DNS cache may still hold the pre-switch TTL. Wait for it to expire, or check the scope of impact.
  2. Mail appears to send successfully, but the recipient never receives it: Check whether SPF/DKIM verification failed, causing the receiving side to flag it as spam or reject it.
  3. In a hybrid configuration, mail doesn’t get delivered, or loops: Check the connector configuration between on-premises and Exchange Online (the rule determining which side is the final delivery destination).

Preventive Measures and Permanent Fixes

Summary

What to Keep in Mind From Today

  1. When you encounter the phrase “email domain,” remember its delivery destination is decided by a specific DNS record type — the MX record.
  2. When planning to switch an MX record, always set its TTL short ahead of time.

How the MTA and mailbox-management roles that Exchange bundles into a single product can actually be split apart is covered in more depth in Understanding Mail Server Fundamentals, using Postfix and Dovecot as an example. If you want to build one with your own hands, check out A “Top 1%” Hands-On Lab: Building a Mail Server with Postfix and Dovecot too.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).