Suped

How to use DKIM to sign emails with different header from domains to comply with DMARC?

Matthew Whittaker profile picture
Matthew Whittaker
Co-founder & CTO, Suped
Published 3 Jun 2025
Updated 15 Aug 2025
9 min read
Email authentication can feel complex, especially when you're dealing with multiple sending domains or third-party services. A common challenge arises when the Header From domain, which is the address your recipients see, differs from the domain used to sign your emails with DKIM. This discrepancy can lead to DMARC (Domain-based Message Authentication, Reporting, and Conformance) failures, impacting your deliverability and potentially leading to your emails being flagged as spam or even landing on a blocklist (or blacklist).
Many organizations use different domains for various purposes. For instance, a marketing email might come from marketing.example.com, while transactional emails (like password resets or order confirmations) might originate from notifications.example.com. Moreover, when using third-party email service providers (ESPs), your emails might be sent through their infrastructure, which often means their domains are involved in the authentication process. Navigating these scenarios requires a solid understanding of how DKIM works with DMARC.
In this guide, I'll walk you through how to properly configure DKIM to ensure DMARC compliance, even when your Header From domain differs from your signing domain. Achieving this alignment is crucial for maintaining a strong sender reputation and ensuring your emails reach the inbox consistently.
Suped DMARC monitoring
Free forever, no credit card required
Learn more
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

Understanding DKIM and DMARC alignment

DomainKeys Identified Mail (DKIM) is an email authentication method designed to detect email spoofing. It allows the receiver to check that an email claiming to come from a specific domain was authorized by the owner of that domain. This is achieved by adding a digital signature to the email header. The sending mail server uses a private key to sign the email, and the receiving server uses a corresponding public key, published in your domain’s DNS records, to verify the signature. If the signature is valid, the email hasn't been tampered with in transit and truly originated from the claimed sender.
DMARC builds upon DKIM and SPF (Sender Policy Framework) by providing a framework for domain owners to specify how receiving email servers should handle emails that fail authentication checks. For DMARC to pass, at least one of SPF or DKIM must pass and align with the Header From domain. This alignment is crucial. Without it, even if SPF or DKIM technically pass, DMARC will still fail, potentially leading to deliverability issues like being sent to spam or even rejected outright.
The key to DKIM alignment lies in the d= tag within your DKIM signature. This tag specifies the domain responsible for signing the email. For DMARC to pass DKIM alignment, the domain in the d= tag must match the organizational domain of the Header From address. This is why understanding DKIM From domain mismatch is so critical.

Defining DKIM alignment

DKIM alignment means that the domain found in the DKIM signature's d= tag must correspond to the Header From domain. This can be an exact match (strict alignment) or an organizational domain match (relaxed alignment).

How DKIM alignment works with DMARC

DMARC evaluates both SPF and DKIM. As long as at least one of these authentication methods passes and achieves alignment with the Header From domain, the DMARC check will pass. This flexibility is particularly useful when dealing with third-party senders, where SPF alignment might be challenging due to the differing Return-Path (or Envelope-From) domain. In such cases, DKIM becomes the primary mechanism for achieving DMARC compliance.
DKIM alignment can be configured in two modes: strict or relaxed. Understanding the difference is crucial for your email setup. Strict alignment requires an exact match between the d= domain in the DKIM signature and the Header From domain. Relaxed alignment, on the other hand, allows for a match at the organizational domain level, meaning a subdomain (e.g., mail.example.com) would align with the root domain (example.com). Relaxed alignment is more common and provides greater flexibility, especially when using ESPs.

Strict alignment

  1. Exact match: The d= domain in the DKIM signature must precisely match the Header From domain.
  2. Less flexible: This mode can be restrictive, especially when using third-party sending services that might sign with their own subdomains.

Relaxed alignment

  1. Organizational domain match: The d= domain must share the same organizational domain as the Header From domain (e.g., sub.example.com aligns with example.com).
  2. More common: This is often preferred by email service providers due to its inherent flexibility across various sending configurations.

Strategies for different sending scenarios

Many email senders use third-party services for their marketing or transactional emails. In these scenarios, the challenge of different domains often comes up. For example, your Header From address might be info@yourdomain.com, but the ESP might use a Return-Path like bounces@esp.com. In this situation, SPF alignment often fails because the SPF check is performed against the Return-Path domain, not your Header From domain. This makes DKIM alignment vital.
When an ESP handles your outgoing emails, they will typically apply their own DKIM signature. This signature will usually have a d= tag that corresponds to their domain or a subdomain they control. While this provides a valid DKIM signature, it won't align with your Header From domain, causing DMARC to fail alignment. This is a common point of confusion for many senders. For example, with Microsoft 365 and Google Workspace, you need to configure custom DKIM settings directly within their admin consoles. Check out our detailed guide on setting up DKIM on Google Workspace.
The ideal solution is to configure custom DKIM signing with your ESP. Most reputable ESPs offer this feature, allowing you to generate a DKIM key pair and publish the public key as a TXT record in your domain’s DNS. This way, the d= tag in the DKIM signature will reflect your domain or a subdomain of it, enabling DKIM alignment with your Header From domain. This is generally the recommended approach for achieving DMARC compliance when using third-party services.
Some advanced setups or ESPs might also support double DKIM signing, where both the ESP and your domain apply a DKIM signature to the email. While this can provide an extra layer of authentication, DMARC only requires one aligned signature to pass. However, if your ESP's signature is somehow invalidated, having your own domain's signature could act as a fallback, ensuring DMARC still passes. This is a nuance to how DKIM precedence is determined.

Implementing DKIM for compliance

The core process of implementing DKIM involves generating a public and private key pair. The private key remains with your sending infrastructure (your mail server or ESP), while the public key is published as a DNS TXT record for your domain. This record tells receiving mail servers where to find the public key to verify your emails. Remember, the d= tag in your DKIM signature should ideally match your Header From domain or its organizational domain to achieve DMARC alignment.
Example DKIM DNS TXT recordTXT
selector1._domainkey.yourdomain.com IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDqX7...YpA0yvQIDAQAB"
When setting up DKIM, you will typically choose a selector (e.g., s=selector1), which allows you to have multiple DKIM keys for a single domain. This is useful if you send emails through different services or need to rotate keys. Remember to ensure that the selector matches the one used in your email headers. For more information, check our practical guide to DKIM selector name examples.

Best practice for email service providers

Always prioritize configuring custom DKIM signing with your email service provider. This ensures that the DKIM signature's d= tag reflects your domain (or a subdomain), leading to proper DMARC alignment and better email deliverability.
After setting up DKIM, it's crucial to monitor your DMARC reports. These reports provide invaluable feedback on how your emails are authenticating and whether they are achieving DMARC alignment. Look for DKIM pass rates and alignment status. If you see failures, particularly for emails sent with a Header From domain different from the signing domain, it indicates an alignment issue that needs to be addressed. Timely monitoring can prevent your emails from ending up on a blocklist or blacklist, which can severely impact your sender reputation.

Views from the trenches

Best practices
Always configure custom DKIM signing for your domain with any third-party email service provider.
Utilize relaxed DKIM alignment settings for flexibility, especially when using subdomains for sending.
Regularly review your DMARC reports to identify any DKIM alignment failures or issues.
Common pitfalls
Failing to set up custom DKIM signing with ESPs, leading to unaligned signatures.
Using strict alignment when it's not necessary, causing DMARC failures for legitimate emails.
Neglecting to monitor DMARC reports, missing critical authentication and alignment issues.
Expert tips
If SPF alignment is difficult due to third-party senders, focus on robust DKIM alignment for DMARC pass.
Consider a dual-signing approach if your ESP supports it, for redundant authentication coverage.
Automate DMARC report analysis to quickly detect and troubleshoot alignment problems.
Expert view
Expert from Email Geeks says that DKIM is your primary option when the header from domain differs from the envelope from domain for DMARC compliance.
2020-03-24 - Email Geeks
Expert view
Expert from Email Geeks says that if DKIM's d= value is the same as your Header-From domain, or a root domain if using relaxed alignment, you will achieve DMARC compliance. DMARC only needs alignment with either SPF or DKIM, not both, to pass authentication.
2020-03-25 - Email Geeks

Ensuring robust email authentication

Effectively managing DKIM to sign emails with different Header From domains for DMARC compliance is a critical aspect of email deliverability. While the scenario of differing domains is common, particularly with third-party sending, DKIM provides a robust solution through its alignment mechanisms.
The key is ensuring that the domain specified in your DKIM signature (the d= tag) aligns with the organizational domain of your Header From address. Whether you opt for strict or relaxed alignment, this ensures DMARC validation, regardless of whether SPF alignment is achieved.
By correctly configuring your DKIM records and consistently monitoring your DMARC reports, you can maintain strong email authentication, avoid common deliverability pitfalls like being put on a blocklist (or blacklist), and ensure your messages consistently reach their intended recipients.

Frequently asked questions

DMARC monitoring

Start monitoring your DMARC reports today

Suped DMARC platform dashboard

What you'll get with Suped

Real-time DMARC report monitoring and analysis
Automated alerts for authentication failures
Clear recommendations to improve email deliverability
Protection against phishing and domain spoofing