Skip to content
DMARC Pulse
Guides

Salesforce

How to set up SPF, DKIM and DMARC for Salesforce

Add _spf.salesforce.com to SPF, activate a 2048-bit DKIM key with two CNAMEs, and see why Bounce Management stops SPF from aligning for DMARC.

Setting up SPF, DKIM and DMARC for Salesforce starts with one question: which path does your mail take? This guide explains how the three records work together at Salesforce and where they usually go wrong. The detailed procedures are in the Salesforce SPF guide and the Salesforce DKIM guide.

Which mail needs these records

Salesforce can send a user's email in three ways.

  • Send through Salesforce. Salesforce's own servers deliver the message with your domain in the From address. The records in this guide apply to this path.
  • Send through Gmail or Office 365. Each user connects a mailbox and the message leaves through that account. Salesforce says you do not need to add SPF or DKIM records to your DNS for this path.
  • Email Relay. Salesforce routes its mail through your company's own mail service. Salesforce's comparison of these options lists no SPF or DKIM step for relay.

How SPF, DKIM and DMARC fit together

SPF (Sender Policy Framework) lists the servers allowed to send for your domain. Salesforce publishes one entry for mail sent from the application, _spf.salesforce.com, and asks you to use only that one. This is its sample record:

TXT
v=spf1 mx include:_spf.salesforce.com ~all

Add the include to the SPF record you already have, because a domain must publish only one. If you also send through Google Workspace or Microsoft 365, Salesforce asks you to put their includes before its own.

DKIM (DomainKeys Identified Mail) adds a signature that proves your domain approved the message. You create a key in Setup under DKIM Keys. Salesforce tells you to use 2048-bit RSA unless an application needs a smaller key. There is no fixed selector, the label receivers use to find the key. You choose a Selector and an Alternate Selector yourself, and Salesforce's examples are example-sf-a and example-sf-b. Salesforce then shows two CNAME records, DNS aliases whose targets sit under custdkim.salesforce.com. Publish both, because Salesforce rotates the key every 30 days and uses the alternate name to do it. Once the key is active it signs mail with your domain, so DKIM alignment stays under your control.

DMARC (Domain-based Message Authentication, Reporting and Conformance) tells receivers how to treat mail that fails these checks and asks them for reports. Salesforce supports and recommends DMARC. The decision and the record are yours. Publish it as a TXT record named _dmarc and start in monitoring mode:

Use this starter value only if no DMARC policy exists at this name. Otherwise edit the existing record, preserving its p=, alignment settings and report addresses; add your monitored rua destination there. Never create a second policy record.

TXT
v=DMARC1; p=none; rua=mailto:dmarc@example.com

Replace that address with your DMARC Pulse reporting address. Salesforce also warns that Gmail and Outlook can treat a high-volume org as a bulk sender, and bulk senders need all three records.

Why DKIM decides DMARC at Salesforce

DMARC passes when SPF or DKIM passes with a domain aligned to the From address, meaning it matches the From domain or shares its organizational domain, the registered domain such as example.com. RFC 9989 §5.3.5 needs only one aligned result.

SPF checks the envelope sender, the return address used for bounced mail. Two options on the Deliverability page in Setup change it:

  • Activate bounce management tracks failed deliveries.
  • Enable compliance with standard email security mechanisms is the option Salesforce calls Email Security Compliance.

With either one on, Salesforce replaces the envelope sender with a bounce address under bnc.salesforce.com. Salesforce calls this a Variable Envelope Return Path (VERP) address. Its example is sampleemail=salesforce.com__abc123@abc123.bnc.salesforce.com. SPF then passes for Salesforce's domain and does not align with yours.

An aligned DKIM signature removes this problem. Salesforce states that DMARC does not also require SPF to align when DKIM passes in alignment. It recommends DKIM if you want to keep bounce processing.

If you cannot create a DKIM key, Salesforce's fallback is an SPF record with both options turned off. A separate Salesforce article recommends turning both off once SPF and DKIM are in place. Weigh that first, because Salesforce stops logging failed deliveries when Bounce Management is off.

The order that keeps mail flowing

  1. Add the include to your SPF record.
  2. Create the DKIM key, publish both CNAMEs and wait for DNS. Salesforce says changes can take up to 72 hours.
  3. Activate the key under DKIM Keys.
  4. If DMARC already exists, preserve its policy, alignment and report addresses; otherwise create one monitoring policy at p=none. Never publish a second record. Confirm Salesforce’s aligned pass in step 5 before relying on an enforcing policy.
  5. Send a test from Salesforce and paste the headers into the Email Header Analyzer. You want dkim=pass, header.d= with your domain and dmarc=pass.
  6. Read your aggregate reports, defined in RFC 9990, until Salesforce and every other legitimate source pass. RFC 9989 §5.1.6 says to fix legitimate mail before you enforce a policy.
  7. Preserve existing policy, alignment and report destinations. For a first deployment, monitor at p=none; after all legitimate senders align, assess p=quarantine. p=reject is optional and needs a separate mailing-list/forwarding risk assessment. Receivers decide individual delivery.

Common problems

Not allowed to send from an unauthorized domain

Salesforce now requires domain verification for mail sent from Salesforce with a domain it does not own. Addresses ending in @gmail.com, @hotmail.com or @outlook.com, Marketing Cloud mail and mail sent through the Gmail or Office 365 integrations are exempt. It began enforcing this after the Spring '26 release. Users see this message in the email composer. The email log shows 550 5.7.1 Delivery not authorized, message discarded. Mail from Apex, flows and automations may fail silently. Create and activate a DKIM key for that exact domain. An authorized email domain is the alternative when you cannot use DKIM. Salesforce's check on each user's own email address still applies.

The Activate button stays grey

Salesforce enables it only after it finds both CNAME records in DNS. Reload the key details page first, because it does not refresh on its own. Then compare your records with the values on that page. Salesforce lists these usual mistakes: a typo, only one of the two CNAMEs published, the root domain repeated in the record name and an extra trailing dot. If you use Cloudflare, set both records to DNS only, because a proxied CNAME is not visible from outside. A CNAME also cannot share its name with another record.

DKIM passes but DMARC fails

Compare the key's Domain field with the domain in the From address. Salesforce counts a mismatch as an alignment failure and asks for a separate key for each domain and subdomain. Enter your email domain in that field and leave your My Domain name out of it. DMARC's relaxed alignment accepts a subdomain of the signing domain. Salesforce's domain verification is stricter and counts a key only when its domain matches the entire From domain.

A new key cannot be activated

Two keys for the same domain cannot share a selector. Salesforce still creates the key when you reuse one, but you cannot activate it. Create a new key with new selectors.

DKIM is missing after a sandbox refresh

DKIM keys do not copy to a sandbox. After a refresh, create the key again and publish its new CNAMEs. An authorized email domain is the option you can import from production.

Recipients see "Sent on behalf of"

The Enable Sender ID compliance option causes this. It adds a Salesforce no-reply address to the Sender field, and some mail clients display it. Clear the option on the Deliverability page. Salesforce recommends it only when a recipient specifically requires Sender ID. Orgs created in Summer '24 or later cannot turn it on.

SPF returns permerror

SPF allows 10 DNS lookups per check, and going over returns permerror. At the time of writing, _spf.salesforce.com publishes a single exists mechanism, so the include uses 2 of the 10. The mx in the sample record uses at least one more. Check the total with the SPF Checker. A second SPF record on the same domain also returns permerror, so always edit the one you have.

Marketing Cloud mail still fails

This guide covers mail sent from the Salesforce application. Marketing Cloud Engagement authenticates through its own Private Domain or Sender Authentication Package. Salesforce's SPF article points to separate content for Marketing Cloud and for Account Engagement (Pardot).

Frequently asked questions

Do I need include:_spf.salesforce.com if DKIM is already active?
DMARC can pass on aligned DKIM alone, so DMARC does not depend on the include. Salesforce still recommends setting up both SPF and DKIM. The include uses 2 of the 10 DNS lookups SPF allows.
Can I keep Bounce Management on with DMARC?
Yes, if an active DKIM key signs the mail with your From domain. SPF does not align while Bounce Management is on, but DMARC can pass through DKIM. Salesforce notes that leaving it on does not ensure delivery.
What DKIM selector does Salesforce use?
Salesforce has no fixed selector. You choose a Selector and an Alternate Selector when you create the key. Salesforce's own examples are example-sf-a and example-sf-b. Your selectors are listed under DKIM Keys in Setup.
Why is the Activate button unavailable on my DKIM key?
Salesforce enables it only after it confirms both CNAME records in DNS. DNS changes can take up to 72 hours. Reload the key details page, compare both records with the values shown and turn off any Cloudflare proxy on them.
Does Salesforce create the DNS records for me?
No. Salesforce generates the values, and your DNS or email administrator publishes them. Salesforce Support cannot guide you through the DNS part, so ask your DNS host if a record will not publish.
Do I need these records if my users send through Gmail or Office 365?
Salesforce says you do not need to add SPF or DKIM records for mail that leaves through the connected Gmail or Office 365 account. Emails sent through workflows and triggers are still sent through Salesforce or Email Relay, so set up the records if that mail uses your domain and goes through Salesforce. Authentication then depends on what you have set up at Google or Microsoft.

Sources consulted

Salesforce: Create DKIM Keys
checked 2026-11-09

Keep it healthy

Know the moment something breaks

Point your DMARC reports to DMARC Pulse and see who sends email as your domain, what fails and why — with a calm alert when anything changes.

Free plan: 1 domain, no credit card.