Salesforce
Salesforce DKIM: create the key, add CNAMEs and activate
Salesforce DKIM setup: create the key in Setup, publish its two CNAME records, activate it, and fix a greyed-out Activate button.
Before you start
Salesforce DKIM is set up on the DKIM Keys page in Setup: create a key, add the two CNAME records Salesforce generates, then click Activate. DKIM (DomainKeys Identified Mail) signs each message so receiving servers can check that it came from your domain and wasn't altered.
- Access. You need the Customize Application permission and edit rights on the domain's DNS zone. Salesforce says it can't directly support the DNS part.
- Domains. Create one key per domain and subdomain you send from. The key's domain must match the entire From domain.
- How the mail leaves. The key signs mail sent through Salesforce. Salesforce says Send through Gmail and Send through Office 365 need no separate DKIM setup. Marketing Cloud and Account Engagement (Pardot) have separate documentation.
Salesforce now fails delivery when the sending domain isn't verified, and an active DKIM key verifies it.
Steps
Create DKIM keys in Salesforce
- In Setup, use Quick Find to select DKIM Keys, then click Create New Key.
- Set RSA key size to 2048-bit, as RFC 8301 recommends.
- In Selector, enter a DKIM selector of up to 62 letters, digits and hyphens, starting with a letter or number. Enter a different one in Alternate Selector.
- In Domain, enter your From domain, such as
example.com, and avoid your org's My Domain name. You can't edit this after saving. - In Domain Match Pattern, enter the same domain. Salesforce advises against wildcards for domains you own.
- Click Save. Salesforce hosts the public keys itself and generates your CNAME records, usually within 15 minutes.
Publish the CNAME records
-
In DKIM Keys, click the key's selector. If TXT Record Status shows
Publishing in progress, wait a few minutes. -
Check the format your DNS host expects. If it appends your domain, enter only
myselector._domainkey. Make sure each name is free: a CNAME can't share its name with another record. If the name is in use, leave it alone and create a key with another selector. -
Add the CNAME Record and Alternate CNAME Record at your DNS host, using the values on that page:
Host Type Value myselector._domainkey.example.comCNAMEmyselector.XXXXXX.custdkim.salesforce.commyalternate._domainkey.example.comCNAMEmyalternate.XXXXXX.custdkim.salesforce.comXXXXXXis a code Salesforce generates.
On Cloudflare, make sure neither record is Proxied.
Caution: a CNAME can't share its name with another record. If the name is in use, leave it alone and create a key with another selector.
Activate the key
- Wait for DNS to update, which can take up to 72 hours.
- Reload DKIM Key Details, which doesn't refresh itself. A green circle with a white checkmark and a confirmation message means the key is ready.
- In DKIM Keys, click Edit for the key, then Activate and OK. Salesforce starts signing mail from the domain.
Salesforce rotates the key every 30 days without action from you. Leave both CNAME records in place, because a receiver that finds no key fails the signature.
Confirm it worked
- Enter your domain and selector in the DKIM checker, or run
nslookup -type=TXT myselector._domainkey.example.com 1.1.1.1. A good answer shows your CNAME, then a TXT record with the public key. A lookup can return only the key active in the rotation, so check the other selector too. - Send a message from production to a mailbox at another provider.
- Paste the headers into the Email Header Analyzer. You want
dkim=passwithheader.d=on your From domain.
Common problems
Activate stays greyed out. Salesforce enables it only after both CNAME records resolve correctly. Look for a proxied CNAME, another record on the same name, a key created for a different domain or a reused selector.
DKIM passes and DMARC fails. Salesforce says alignment fails when the key's Domain doesn't match the From domain, and RFC 9989 counts only an aligned signing domain. Create a new key for the right domain. See also SPF for Salesforce.
Not allowed to send from an unauthorized domain. Email Composer shows this when the domain isn't verified. For automations, search your email logs for 550 5.7.1 Delivery not authorized, message discarded. Activate a key for that domain or set up an authorized email domain.
A relay breaks the signature. Salesforce says a relay can alter signed headers, and it suggests deactivating the key and relying on the relay's DKIM. Caution: confirm the relay signs your domain first. The verification rule applies to email relay, so set up an authorized email domain before you deactivate, or delivery can fail.