Lab 08: External Mail Flow and DNS Records

Configured external mail flow for the Nietz Ltd Microsoft 365 tenant, connected Exchange Online to the public domain, enabled DKIM, published DMARC and validated inbound and outbound delivery through the Support shared mailbox.

Overview

In this lab, I connected the public domain nietz.co.uk to Microsoft 365 Exchange Online by configuring the required DNS records in Cloudflare and confirming Microsoft 365 recognised the records as valid.

I then enabled DKIM, published a DMARC monitoring record, and validated external mail flow by sending and receiving test messages through the Support shared mailbox.

Objective

The objective was to prove that nietz.co.uk was correctly configured for Exchange Online mail routing, Outlook Autodiscover, SPF, DKIM and DMARC, and that the Support shared mailbox could send and receive external mail successfully.

Environment

Environment
ComponentValue
CompanyNietz Ltd
Public / tenant domainnietz.co.uk
Microsoft 365 tenant domainnietzltd.onmicrosoft.com
DNS hosting providerCloudflare
Mail platformExchange Online
Shared mailbox validated[email protected]
External test sender / recipient[email protected]
Administration portals usedMicrosoft 365 admin center, Exchange admin center and Cloudflare DNS

Configuration

1. Domain Status Before Exchange DNS Connection

I reviewed the Microsoft 365 domain status for nietz.co.uk before connecting Exchange Online DNS services.

Microsoft 365 domain overview for nietz.co.uk before Exchange DNS services were selected
Figure 1Microsoft 365 showed the domain as managed at Cloudflare with no services selected.
Context: This established the starting point before Exchange Online DNS records were connected to the public domain.

2. Required Exchange Online DNS Records

I reviewed the Microsoft 365 DNS requirements for Exchange Online and identified the required MX record, Autodiscover CNAME record and SPF TXT record.

Microsoft 365 required MX CNAME and TXT records for Exchange Online
Figure 2Microsoft 365 displayed the expected MX record, Autodiscover CNAME record and SPF TXT record for Exchange Online.
Context: These records control inbound mail routing, Outlook Autodiscover and SPF sender validation for the custom domain.

3. Exchange DNS Records Added in Cloudflare

I added the required Exchange Online MX record, Autodiscover CNAME record and SPF TXT record in Cloudflare and confirmed that the records were set to DNS only where appropriate.

Cloudflare DNS showing Exchange Online MX, Autodiscover CNAME and SPF TXT records
Figure 3Cloudflare contained the Exchange Online MX record, Autodiscover CNAME record and SPF TXT record for nietz.co.uk.
Context: Exchange Online mail flow depends on public DNS. The MX record routes inbound mail to Microsoft 365, the Autodiscover CNAME helps Outlook locate Exchange Online services, and the SPF TXT record authorises Microsoft 365 to send mail for the domain.

4. Microsoft 365 DNS Health Confirmed

I returned to Microsoft 365 and confirmed that the Exchange DNS records were detected successfully.

Microsoft 365 DNS records showing OK status for MX, SPF TXT and Autodiscover CNAME
Figure 4Microsoft 365 confirmed the Exchange Online MX record, SPF TXT record and Autodiscover CNAME record as OK.
Context: Microsoft 365 validation confirmed that the public DNS records were visible and matched the expected Exchange Online configuration.

5. DKIM Status Before Configuration

I reviewed the DKIM status in the Exchange admin center and confirmed that nietz.co.uk was not yet signing messages with DKIM because the required selector records were missing.

Exchange admin center showing DKIM disabled and CNAME missing for nietz.co.uk
Figure 5Exchange Online showed DKIM disabled with missing CNAME records.
Context: DKIM adds cryptographic signing to outbound mail so recipients can verify that messages were authorised by the sending domain and not modified in transit.

6. DKIM Selector Records Identified

I opened the DKIM configuration details for nietz.co.uk and recorded the required selector CNAME records.

Exchange admin center showing required selector1 and selector2 DKIM CNAME records
Figure 6Exchange Online provided the required selector1 and selector2 DKIM CNAME values.
Context: Microsoft 365 requires two DKIM selector CNAME records so Exchange Online can publish and rotate signing keys for the domain.

7. DKIM CNAME Records Added in Cloudflare

I added the required DKIM selector CNAME records in Cloudflare and confirmed that both records were present.

Cloudflare DNS showing DKIM selector1 and selector2 CNAME records
Figure 7Cloudflare contained both DKIM selector CNAME records for nietz.co.uk.
Context: DKIM selector records allow recipient mail systems to locate the public keys used to validate Microsoft 365 DKIM signatures.

8. DKIM Enabled for the Domain

I enabled DKIM signing for nietz.co.uk after the CNAME records were available in public DNS.

Exchange admin center showing DKIM enabled for nietz.co.uk
Figure 8Exchange Online confirmed DKIM signing was enabled for nietz.co.uk.
Context: Enabling DKIM improves outbound email trust and works alongside SPF and DMARC to help receiving mail systems verify messages from the domain.

9. DMARC Record Published

I added a DMARC TXT record for nietz.co.uk in Cloudflare using monitoring mode, so DMARC reporting could be introduced without immediately rejecting mail.

Cloudflare DNS showing DMARC TXT record for nietz.co.uk
Figure 9Cloudflare showed the DMARC TXT record for nietz.co.uk.
Context: DMARC helps domain owners monitor how receiving systems handle mail that fails SPF or DKIM checks. A monitoring policy is a safe first step before moving to stricter enforcement.

10. External Inbound Mail Received

I sent an external test message from Gmail to the Support shared mailbox and confirmed that Exchange Online delivered the message to [email protected].

Support shared mailbox showing external inbound mail received from Gmail
Figure 10Support shared mailbox received external inbound mail from Gmail.
Context: This validated that the public MX record routed external mail for nietz.co.uk into Exchange Online successfully.

11. External Outbound Mail Sent from Support

I sent an outbound test message from the Support shared mailbox to an external Gmail address.

Support shared mailbox Sent Items showing external outbound mail sent to Gmail
Figure 11Support shared mailbox sent an external outbound mail test.
Context: Outbound testing confirmed that the shared mailbox could send external mail through Exchange Online using the custom domain identity.

12. External Outbound Mail Received in Gmail

I confirmed that the external Gmail mailbox received the message sent from [email protected].

Gmail showing outbound test received from support@nietz.co.uk
Figure 12Gmail received the outbound mail sent from the Support shared mailbox.
Context: This proved end-to-end outbound delivery from Exchange Online to an external recipient.

13. Message Trace Validation

I used Exchange Online message trace to confirm that the external inbound and outbound test messages were processed successfully.

Exchange Online message trace showing external inbound and outbound mail delivered
Figure 13Exchange Online message trace confirmed external mail delivery.
Context: Message trace provides administrator-level evidence of mail flow status and is a common helpdesk and Microsoft 365 support tool for investigating delivery issues.

Validation

The lab was validated when Microsoft 365 confirmed the Exchange Online DNS records, Cloudflare showed the required MX, Autodiscover CNAME, SPF TXT, DKIM CNAME and DMARC TXT records, DKIM signing was enabled, and external mail successfully flowed into and out of the Support shared mailbox.

External inbound delivery was confirmed when the Support shared mailbox received a Gmail test message. External outbound delivery was confirmed when Gmail received a message sent from the Support shared mailbox. Exchange Online message trace confirmed the mail flow results from an administrator view.

Key Technical Outcomes

This lab demonstrated how public DNS controls Microsoft 365 mail routing and how Exchange Online depends on correctly published MX, CNAME and TXT records.

It also showed the relationship between SPF, DKIM and DMARC in Microsoft 365 mail authentication, and how message trace can validate delivery after DNS and mailbox configuration changes.

Summary

  • I connected nietz.co.uk to Exchange Online using the required Microsoft 365 DNS records.
  • I configured the Exchange Online MX record, Autodiscover CNAME record and SPF TXT record in Cloudflare.
  • I enabled DKIM signing for the custom domain after publishing the required selector records.
  • I published a DMARC monitoring record for the domain.
  • I validated inbound and outbound external mail flow through the Support shared mailbox.
  • I confirmed delivery using Exchange Online message trace.