Networking & DNS

Connect Microsoft 365 email to a domain hosted on cPanel

Add the DNS records Microsoft 365 needs in cPanel Zone Editor: verification TXT, MX, autodiscover CNAME, SPF and DKIM, while keeping your website on MdmHost.

IntermediatecPanel hosting2 min read

Many businesses host their website on cPanel and their email on Microsoft 365. That works well, but Microsoft needs several DNS records and cPanel must be told that it no longer handles mail for the domain. Missing the autodiscover record or Email Routing are the two most common mistakes.

Before you start

  • Your domain uses the MdmHost nameservers, so you edit DNS in cPanel. Otherwise add the records at your DNS provider.
  • A Microsoft 365 subscription and access to the Microsoft 365 admin center → Settings → Domains, where Microsoft shows the exact values for your domain.
  • If mailboxes already exist in cPanel, plan to move the old mail; see IMAP migration.

Step 1: verify the domain

  1. In the Microsoft 365 admin center, add the domain and choose Add a TXT record as verification method.
  2. In cPanel open Domains → Zone Editor → Manage for the domain and click Add Record → TXT.
  3. Name: example.com.; Record: the value Microsoft shows, like MS=ms12345678. Save.
  4. Click Verify in Microsoft 365. It can take a few minutes.

Step 2: add the email records

TypeNameValue
MXexample.com.Priority 0, destination example-com.mail.protection.outlook.com (from the admin center)
CNAMEautodiscover.example.com.autodiscover.outlook.com
TXT (SPF)example.com.v=spf1 include:spf.protection.outlook.com +a +mx ~all
  • Delete the old MX record that points to your own domain.
  • cPanel creates its own autodiscover records for cPanel mail. Delete or edit the existing autodiscover A/CNAME record first, otherwise you cannot add Microsoft's CNAME and Outlook will find the wrong server.
  • Keep only one SPF record. Edit the existing v=spf1 TXT instead of adding a second one. Keep +a +mx (or the server IP) if your website on MdmHost still sends mail.

Step 3: tell cPanel mail is remote

  1. Open cPanel → Email → Email Routing.
  2. Select the domain, choose Remote Mail Exchanger and click Change.

Without this, forms and other mailboxes on the same server deliver locally and messages never reach Microsoft 365. More detail in MX records and Email Routing.

Step 4: enable DKIM in Microsoft 365

  1. In the Microsoft Defender portal open Email & collaboration → Policies → Threat policies → Email authentication settings → DKIM.
  2. Select the domain; Microsoft shows two CNAME records, selector1._domainkey and selector2._domainkey.
  3. Add both as CNAME records in Zone Editor, then enable DKIM signing in the portal.

Tip: Finish with a DMARC record, starting with p=none. See DMARC reports and policies.

Optional records

Microsoft may list SRV and CNAME records for Teams/Skype (_sip._tls, _sipfederationtls._tcp, sip, lyncdiscover) and for device management (enterpriseregistration, enterpriseenrollment). Add them only if you use those services.

Troubleshooting

  • Outlook connects to the cPanel server: an old autodiscover record still exists; check with nslookup autodiscover.example.com.
  • Admin center says records are missing: DNS caching; wait for the TTL, see check DNS propagation.
  • Website contact forms no longer arrive: Email Routing is still Local.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.