E-Mail
Mail Providers
Office 365
Create Dkim

Creating a DKIM for Office365

Install OpenDKIM

apt install opendkim-tools

Generate Selectors

opendkim-genkey -D /root -d <domain> -s selector1
opendkim-genkey -D /root -d <domain> -s selector2

Then view the DNS record by running:

cat /root/selector1.txt
cat /root/selector2.txt

Adding the DKIM to DNS

Navigate to DNS

Go to your DNS Provider's Portal

Create TXT

  1. Click "Add Record" on the DNS page
  2. Select a TXT-Record
  3. Set the name as selector1._domainkey
  4. Set the value as the DKIM selector value from the /root/selector1.txt, it should look similar to:
"v=DKIM1; h=sha256; k=rsa; "p=XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  1. Click "Save"

Selector 2

Repeat the same steps for selector2

Adding the private key on Office365

Visit the 365 DKIM Page

  1. Visit the Office365 Admin Portal (opens in a new tab)

Select your domain

  1. Click the domain that you want to enable DKIM for.

Enable DKIM Signatures

  1. Change the "Sign messages for this domain with DKIM signatures" toggle to "Enabled"

Upload Key to 365 Admin

  1. Upload the private keys from the selector1.private and selector2.private files to Office365

Microsoft Managed DKIM

Alternatively, you might want to use the managed DKIM provided by Microsoft which can be accomplished by:

Navigate to DNS

Go to your DNS Provider's Portal like Cloudflare's DNS Page (opens in a new tab)

Create CNAME

  1. Click "Add Record" on the DNS page

  2. Select a CNAME-Record

  3. Set the record like the following with example-com and examplecom filled in as your domain.

Set the "name" as:

selector1._domainkey

Set the "value" as:

selector1-example-com._domainkey.examplecom.onmicrosoft.com

Selector 2

Repeat the same steps for selector2