Email Authentication for Transactional vs. Marketing Emails

Technical differences in authentication setup for transactional and marketing emails, including subdomain considerations and policy recommendations.

Email authentication is a critical component of deliverability for both transactional and marketing emails. While the high-level concepts are the same, there are important technical differences in how authentication should be configured for each type of email. This comprehensive guide will dive deep into the nuances of email authentication for transactional vs marketing emails, including subdomain setup, SPF and DKIM policies, DMARC alignment, and industry best practices. Whether you're just getting started with email authentication or looking to optimize your existing implementation, this guide will provide actionable insights you can use to ensure your emails reach the inbox.

Understanding Email Authentication Fundamentals

Before we explore the differences between transactional and marketing email authentication, it's important to have a solid grasp of the key authentication protocols and how they work together to establish trust and prevent spoofing and phishing.

SPF (Sender Policy Framework)

SPF allows domain owners to specify which mail servers are authorized to send email on behalf of their domain. This is done by publishing a DNS TXT record that lists the approved sending IP addresses or included providers. Receivers check SPF against the envelope sender (the Return-Path or MAIL FROM domain), not the visible From address.

Here's an example of an SPF record:

"v=spf1 ip4:192.0.2.1 ip4:192.0.2.2 include:_spf.google.com -all"

This record authorizes the IP addresses 192.0.2.1 and 192.0.2.2, as well as any servers listed in the SPF record for _spf.google.com, to send email for the domain. The -all directive indicates a hard fail for any other servers.

Note: -all (hard fail) and ~all (soft fail) both tell receivers that unlisted servers are not authorized. Once DMARC is in place it decides the outcome, so either works; use -all once you are confident the record lists every legitimate sender. Also keep the record within SPF's limit of 10 DNS lookups.

DKIM (DomainKeys Identified Mail)

DKIM provides a cryptographic signature that ties the message to the signing domain and shows the email hasn't been altered in transit. With DKIM, the sender publishes a public key in their DNS records and signs outgoing emails with a corresponding private key. Email providers then use the public key to verify the signature and authenticate the message.

The following diagram illustrates the DKIM signing and verification process:

The sending server signs the message with its private key and adds a DKIM-Signature header. The receiver fetches the public key from DNS and verifies the signature. A match passes; a changed message or wrong key fails.
How DKIM signing and verification work

To implement DKIM, you'll need to generate a public/private key pair and add the public key to your domain's DNS as a TXT record. The record will look something like this:

default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDQPu3SXrRMTvJ+jFvNsHvKo6Kw4pqk7J5RgQy/Cmlgn8aTYvx/qAWbJNe8xmbK8..."

You'll then configure your email sending platform or SMTP server to sign outgoing messages with the corresponding private key.

DMARC (Domain-based Message Authentication, Reporting, and Conformance)

DMARC builds upon SPF and DKIM to provide a policy framework for specifying how email providers should handle authentication failures. A message passes DMARC when SPF or DKIM passes and that domain aligns with the domain in the From header; one aligned pass is enough. With DMARC, domain owners can instruct providers to quarantine or reject emails that fail this check, as well as receive aggregate and forensic reports on authentication results.

A DMARC record is published as a DNS TXT record at _dmarc.yourdomain.com and includes several key directives:

Directive Description
v DMARC version (should be DMARC1)
p Policy for handling failed verifications (none, quarantine, reject)
rua Reporting URI for aggregate reports
ruf Reporting URI for forensic reports
sp Policy for subdomains (defaults to the p value)

Here's an example of a DMARC record using these directives:

"v=DMARC1; p=quarantine; rua=mailto:dmarc-aggregate@example.com; ruf=mailto:dmarc-afrf@example.com; sp=reject; adkim=s; aspf=s;"

This record specifies a quarantine policy for the organizational domain, a reject policy for subdomains, and requests both aggregate and forensic reports to be sent to the specified email addresses. It also requires strict alignment for both DKIM and SPF.

Important: Before publishing a reject policy, it's crucial to ensure all legitimate email sources are properly authenticated to avoid delivery failures.

Differences in Authentication for Transactional vs Marketing Emails

While the core authentication protocols are the same for both transactional and marketing emails, there are important differences in how they should be implemented to ensure optimal deliverability and security.

Subdomain Setup

One of the key differences between transactional and marketing email authentication is the use of subdomains. Transactional emails, such as password resets, order confirmations, and account notifications, are typically sent from a subdomain like transactional.example.com or mail.example.com. This helps separate them from marketing messages and allows for more granular authentication policies.

Marketing emails, on the other hand, are usually sent from the organizational domain (example.com) or a branded subdomain like newsletter.example.com or offers.example.com. This allows for consistent branding and helps build trust with subscribers.

The following diagram illustrates a sample subdomain structure for transactional and marketing emails:

Transactional mail such as receipts and password resets uses its own subdomain, SPF record and DKIM selector and can move to a strict DMARC policy early. Marketing mail uses a separate branded subdomain and selector and often steps up from p=none.
Keeping transactional and marketing mail apart

When setting up subdomains for email authentication, it's important to create separate SPF and DKIM records for each subdomain. Remember that SPF is checked on the Return-Path domain, so the SPF record belongs on whichever domain your provider uses for bounces. This allows you to specify different authorized sending servers and signing keys for transactional and marketing emails.

SPF Considerations for Subdomains

When creating SPF records for subdomains, you have two options:

  1. Create a separate SPF record for each subdomain
  2. Use the include directive to reference the organizational domain's SPF record

For example, if your organizational domain's SPF record includes include:_spf.example.com, you can create a subdomain SPF record like this:

"v=spf1 include:_spf.example.com -all"

This ensures that any updates to the organizational domain's SPF record will automatically apply to the subdomain as well.

Best Practice: Use separate SPF records for transactional and marketing subdomains to allow for more granular control over authorized sending servers.

DKIM Considerations for Subdomains

Like SPF, it's recommended to use separate DKIM keys for transactional and marketing subdomains. This allows you to rotate keys independently and reduces the impact of a key compromise.

When generating DKIM keys for subdomains, be sure to use a unique selector for each key. The selector is prepended to the ._domainkey subdomain in the DNS record. For example:

transactional._domainkey.example.com IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GC..."
marketing._domainkey.example.com IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GC..."

DKIM Key Rotation

To maintain security and minimize disruption, it's important to regularly rotate your DKIM keys. When rotating keys, be sure to:

  • Generate a new key pair
  • Publish the new public key to your DNS records
  • Update your email sending platform or SMTP server to use the new private key
  • Allow time for the old and new keys to coexist to avoid verification failures during the transition
  • Remove the old key from DNS once the transition is complete

DMARC Policy Alignment

DMARC passes when either SPF or DKIM passes and is aligned; you don't need both. Alignment means that the domain used for SPF (the Return-Path domain) or the domain in the DKIM signature (d=) matches the domain in the email's "From" header. Under relaxed alignment, the default, the domains only need to share the same organizational domain, so bounces.example.com aligns with example.com. Under strict alignment (adkim=s or aspf=s), they must match exactly.

For transactional emails sent from subdomains, the simplest setup is to authenticate SPF and DKIM on the same subdomain that appears in the "From" header.

For example, if your transactional emails are sent from transactional.example.com with SPF and DKIM authenticated on that subdomain, the "From" header should be something like sender@transactional.example.com.

Marketing emails, on the other hand, often use the organizational domain in the "From" header for branding purposes, while the ESP signs with DKIM and handles bounces on a subdomain. With relaxed alignment this still passes, because the subdomain shares the organizational domain. If you set strict alignment, the DKIM or SPF domain must exactly match the "From" domain.

Note: Relaxed alignment is the DMARC default and is what most senders use. Strict alignment gives you tighter control but breaks easily when a provider signs or bounces on a subdomain, so only switch to it once your reports show every source aligns exactly.

DMARC Policy Recommendations

When setting up DMARC for transactional and marketing emails, it's important to choose the appropriate policy based on your authentication implementation and risk tolerance.

Transactional Email DMARC Policy

For transactional emails, it's recommended to use a p=quarantine or p=reject policy to ensure only authenticated messages are delivered. This is especially important for sensitive transactional messages like password resets and financial notifications.

A DMARC record for transactional email subdomains might look like this:

_dmarc.transactional.example.com IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc-aggregate@example.com"

This record specifies a reject policy for messages that fail DMARC (no aligned SPF or DKIM pass) and requests aggregate reports on authentication results.

Marketing Email DMARC Policy

For marketing emails, a more gradual approach to DMARC enforcement is often recommended to avoid disrupting legitimate email campaigns. Many organizations start with a p=none policy to gather baseline authentication data before moving to p=quarantine and eventually p=reject.

A DMARC record for marketing email domains might look like this:

"v=DMARC1; p=none; rua=mailto:dmarc-aggregate@example.com; ruf=mailto:dmarc-afrf@example.com"

This record specifies a monitor-only policy with both aggregate and forensic reporting enabled. This allows you to identify and correct any authentication issues before moving to a stricter policy.

Subdomain Policy Overrides

In some cases, you may want to specify a different DMARC policy for subdomains than for the organizational domain. This can be done using the sp directive.

For example, to use a reject policy for the organizational domain but a quarantine policy for subdomains, you could use a record like this:

"v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc-aggregate@example.com"

This allows for more granular control over subdomain policies while still maintaining a strict policy for the organizational domain.

Implementing Email Authentication

Now that we've covered the key differences between transactional and marketing email authentication, let's walk through the steps to implement SPF, DKIM, and DMARC for your domains.

Step 1: Identify All Email Sources

The first step in implementing email authentication is to identify all sources that send email on behalf of your domain. This includes:

  • Your own mail servers and IP addresses
  • Third-party email service providers (ESPs) like Mailchimp, Constant Contact, etc.
  • Transactional email providers like SendGrid, Mailgun, etc.
  • Any other services or applications that send email using your domain

Create a comprehensive inventory of all email sources along with their IP addresses or hostnames. You'll need this information to create accurate SPF and DKIM records.

Step 2: Configure SPF Records

Once you have a list of all email sources, you can create SPF records for your organizational domain and any subdomains used for email.

Start by creating a record for your organizational domain that includes all authorized IP addresses and hostnames. For example:

"v=spf1 ip4:192.0.2.1 ip4:192.0.2.2 include:_spf.google.com include:sendgrid.net -all"

Then create separate records for the subdomains your providers use as the Return-Path for transactional and marketing mail, listing only the services that send for each. Check that no record goes over the 10 DNS lookup limit, and publish only one SPF record per domain or subdomain.

Step 3: Set Up DKIM Signing

Enable DKIM signing in each sending platform using your own domain, not the provider's default. Most providers give you DNS records (often CNAMEs) to publish under a unique selector. Use different selectors for transactional and marketing streams so you can rotate or revoke keys independently, and use keys of at least 1024 bits (2048 bits where your DNS provider supports it).

Step 4: Publish DMARC and Move to Enforcement

Publish a DMARC record with aggregate reporting. Transactional subdomains with a small, well-known set of senders can usually move to p=reject quickly. For marketing domains, start with p=none, use the aggregate reports to fix any source that fails, and then step up to p=quarantine and p=reject. Gmail and Yahoo require bulk senders to have SPF, DKIM and a DMARC record in place, so treat this step as essential.

Conclusion

Transactional and marketing email use the same three protocols, but separating them onto their own subdomains, SPF records and DKIM selectors keeps a problem in one stream from hurting the other. Get every source authenticated and aligned, monitor your DMARC reports, and move each domain to enforcement as soon as the data shows it is safe. Send a test message after each change to confirm that SPF, DKIM and DMARC all pass.

Check your own email in a minute. Send one email to a test address and see your SPF, DKIM, DMARC and spam score.
Test your email
Was this guide helpful?

Topics: Deliverability, Authentication, Best Practices, Technical