DKIM, DMARC, and SPF in Microsoft 365
Setting up DKIM
DKIM stands for DomainKeys Identified Mail
- Ensure no config is already active:
Get-DkimSigningConfig -Identity domain.com|Format-List
- Create a new DKIM config on the custom domain:
New-DkimSigningConfig -DomainName domain.com -Enabled $false
- Generate the CNAMEs to publish:
Get-DkimSigningConfig -Identity domain.com | Format-List Selector1CNAME, Selector2CNAME
- Publish the generated CNAMEs in the custom domain's DNS and wait for propagation. Note: CNAME hosts will always be
selector1._domainkey
,selector2._domainkey
Their values will always be whatever Exchange Online PowerShell outputs. - Enable to newly created config:
Set-DkimSigningConfig -Identity domain.com -Enabled $true
- Check the validity of the DKIM configuration with a DKIM Checker.
Setting up SPF
SPF stands for Sender Policy Framework
- Create your SPF record. Unless any special configuration is needed, use the example:
v=spf1 include:spf.protection.outlook.com -all
- Publish the new TXT record to the domain's DNS. Set the host field to the root domain, or
@
, ordomain.com.
. - Check the validity of the SPF configuration with an SPF Checker.
Note
It may be worth including an a
at the beginning of the SPF record, as it appears to be an alias to the sending server. This helps with deliverability when a third party is sending email on behalf of an address and those mails being sent to spam, i.e. RMM tools sending ticket mails.
For example: v=spf1 a include:spf.protection.outlook.com -all
Setting up DMARC
DMARC stands for Domain-based Message Authentication, Reporting, and Conformance.
- Create your DMARC record. Unless any special configuration is needed, use the example:
v=DMARC1; p=none; pct=100; aspf=r; adkim=r;
- Publish the new TXT record to the domain's DNS. Set the host field to
_dmarc
. - Check the validity of the DMARC configuration with a DMARC Checker.
Example DNS Records
Purpose | Type | Host | Value |
---|---|---|---|
DKIM | CNAME | selector1._domainkey |
selector1-domain-com._domainkey.domain.onmicrosoft.com |
DKIM | CNAME | selector2._domainkey |
selector2-domain-com._domainkey.domain.onmicrosoft.com |
DMARC | TXT | @ or _dmarc |
v=DMARC1; p=none; pct=100; aspf=r; adkim=r; |
SPF | TXT | @ |
v=spf1 include:spf.protection.outlook.com -all |