Sign In
Cold Outreach

Boost Your 2025 Deliverability How to Avoid Spam Filters …

Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based hubspot-email-marketing-tactics-to-boost-roi/" class="internal-link" title="3 Hubspot Email Marketing Tactics to Boost ROI">email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: Basic SPF record for a single mail server. If your mail server’s IP address is 203.0.113.45, your SPF record might look like this:
v=spf1 ip4:203.0.113.45 -all
This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: The Importance of SPF – The “Unauthorized Sender” Scenario Imagine you only configure DKIM and DMARC but not SPF. A phisher discovers your domain and sends out hundreds of emails claiming to be from your company, but using their own mail server. Because you didn’t set up SPF, the receiving mail servers have no way of knowing that this mail server *isn’t* authorized to send emails from your domain. Although DKIM will likely fail (since the phisher can’t sign with your private key), some less strict email systems might still deliver the message, potentially causing damage. Example 2: How DKIM Prevents Tampering Let’s say you send an email that *passes* SPF. However, somewhere between your server and the recipient’s, the email is intercepted and altered. Because you implemented DKIM, the recipient server can verify the email’s DKIM signature. Since the email was tampered with, the signature will no longer match the content, causing the DKIM check to fail. This alerts the recipient that the email may not be trustworthy. Expert Tip: “Think of SPF, DKIM, and DMARC as a three-legged stool. Each protocol plays a vital role in ensuring email authentication. If one leg is missing or weak, the entire structure is compromised.”

SPF Configuration: Letting the World Know You’re Legit

How to avoid <a href=spam filters email marketing - A screenshot showing an example SPF record in a DNS management interface, highlighting the key components of the record." title="Illustration for A screenshot showing an example SPF record in a DNS management interface, highlighting the key components of the record." width="512" height="512" / class="wp-image-224 wp-image-12401">
Configuring SPF involves creating a TXT record in your domain’s DNS settings. This record specifies which mail servers are permitted to send emails on behalf of your domain. The syntax can seem a bit daunting at first, but it’s actually quite straightforward once you understand the basic components. The general structure of an SPF record is: v=spf1 [mechanisms] [modifiers] Let’s break down each component:
  • v=spf1: This indicates the SPF version being used (always spf1). It’s mandatory.
  • Mechanisms: These define the authorized senders. Common mechanisms include:
    • ip4: Allows specific IPv4 addresses or ranges. Example: ip4:192.0.2.0/24
    • ip6: Allows specific IPv6 addresses or ranges. Example: ip6:2001:db8::/32
    • a: Allows the IP addresses of the A record(s) for a specific domain. Example: a:example.com
    • mx: Allows the IP addresses of the MX record(s) for a specific domain. Example: mx:example.com
    • include: Includes the SPF record of another domain. Example: include:servers.net (This is critical for third-party sending services)
    • all: Specifies what to do with emails that don’t match any of the previous mechanisms. Common options: -all (hard fail, reject), ~all (soft fail, mark as suspicious), +all (allow all, which defeats the purpose of SPF!)
  • Modifiers: These provide additional instructions. The most common modifier is:
    • redirect: Specifies another domain’s SPF record to use. Rarely used. Example: redirect=example.com
Example 1: Basic SPF record for a single mail server. If your mail server’s IP address is 203.0.113.45, your SPF record might look like this:
v=spf1 ip4:203.0.113.45 -all
This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance, Example 1: The Importance of SPF – The “Unauthorized Sender” Scenario Imagine you only configure DKIM and DMARC but not SPF. A phisher discovers your domain and sends out hundreds of emails claiming to be from your company, but using their own mail server. Because you didn’t set up SPF, the receiving mail servers have no way of knowing that this mail server *isn’t* authorized to send emails from your domain. Although DKIM will likely fail (since the phisher can’t sign with your private key), some less strict email systems might still deliver the message, potentially causing damage. Example 2: How DKIM Prevents Tampering Let’s say you send an email that *passes* SPF. However, somewhere between your server and the recipient’s, the email is intercepted and altered. Because you implemented DKIM, the recipient server can verify the email’s DKIM signature. Since the email was tampered with, the signature will no longer match the content, causing the DKIM check to fail. This alerts the recipient that the email may not be trustworthy. Expert Tip: “Think of SPF, DKIM, and DMARC as a three-legged stool. Each protocol plays a vital role in ensuring email authentication. If one leg is missing or weak, the entire structure is compromised.”

SPF Configuration: Letting the World Know You’re Legit

How to avoid spam filters email marketing - A screenshot showing an example SPF record in a DNS management interface, highlighting the key components of the record.
Configuring SPF involves creating a TXT record in your domain’s DNS settings. This record specifies which mail servers are permitted to send emails on behalf of your domain. The syntax can seem a bit daunting at first, but it’s actually quite straightforward once you understand the basic components. The general structure of an SPF record is: v=spf1 [mechanisms] [modifiers] Let’s break down each component:
  • v=spf1: This indicates the SPF version being used (always spf1). It’s mandatory.
  • Mechanisms: These define the authorized senders. Common mechanisms include:
    • ip4: Allows specific IPv4 addresses or ranges. Example: ip4:192.0.2.0/24
    • ip6: Allows specific IPv6 addresses or ranges. Example: ip6:2001:db8::/32
    • a: Allows the IP addresses of the A record(s) for a specific domain. Example: a:example.com
    • mx: Allows the IP addresses of the MX record(s) for a specific domain. Example: mx:example.com
    • include: Includes the SPF record of another domain. Example: include:servers.net (This is critical for third-party sending services)
    • all: Specifies what to do with emails that don’t match any of the previous mechanisms. Common options: -all (hard fail, reject), ~all (soft fail, mark as suspicious), +all (allow all, which defeats the purpose of SPF!)
  • Modifiers: These provide additional instructions. The most common modifier is:
    • redirect: Specifies another domain’s SPF record to use. Rarely used. Example: redirect=example.com
Example 1: Basic SPF record for a single mail server. If your mail server’s IP address is 203.0.113.45, your SPF record might look like this:
v=spf1 ip4:203.0.113.45 -all
This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance,

How to Avoid Spam Filters in Email Marketing

Email marketing can be incredibly effective, but only if your messages reach the intended recipients. Spam filters are constantly evolving, making it crucial to stay informed and adapt your strategies to avoid getting caught. This article focuses on a critical aspect: ensuring proper email authentication to improve deliverability and bypass spam filters.

We’ll delve into the practical steps you can take to configure SPF, DKIM, and DMARC records for your domain. By implementing these measures correctly, you can significantly improve your email marketing success and protect your brand reputation.

Understanding Email Authentication: SPF, DKIM, and DMARC

How to avoid spam filters email marketing - A diagram illustrating how SPF, DKIM, and DMARC work together to authenticate an email, starting from the sender's server and ending at the recipient's inbox.
Email authentication protocols are essential for proving to email providers (like Gmail, Yahoo, and Outlook) that the emails you send are genuinely from you and haven’t been forged by spammers. These protocols—SPF (Sender Policy Framework), DKIM (DomainKeys Identified Mail), and DMARC (Domain-based Message Authentication, Reporting & Conformance)—work together to establish trust and improve email deliverability. Understanding each protocol and how they interact is the first step to avoiding spam filters. SPF specifies which mail servers are authorized to send emails on behalf of your domain. Think of it as a list of approved senders that receiving servers can check against. If an email claims to be from your domain but originates from a server not on your SPF list, it’s more likely to be flagged as spam. DKIM adds a digital signature to your emails, allowing receiving servers to verify that the email hasn’t been tampered with during transit and that it truly originated from your domain. This signature is encrypted and can only be decrypted using a public key published in your DNS records. DMARC builds upon SPF and DKIM by specifying what action receiving servers should take if an email fails SPF and/or DKIM authentication checks. You can instruct them to quarantine (send to spam), reject the email outright, or do nothing (monitor). DMARC also provides reporting mechanisms, allowing you to receive feedback on authentication results and identify potential issues or fraudulent activity. Why are SPF, DKIM, and DMARC important?
  • Improved Deliverability: Email authentication helps ensure your messages reach the inbox, rather than the spam folder.
  • Enhanced Security: These protocols make it more difficult for spammers to spoof your domain and send phishing emails to your customers.
  • Brand Protection: By implementing DMARC, you can actively protect your brand reputation and prevent malicious actors from damaging your credibility.
  • Increased Trust: Authentication signals to email providers that you are a legitimate sender, which can improve your overall sender reputation.
Example 1: The Importance of SPF – The “Unauthorized Sender” Scenario Imagine you only configure DKIM and DMARC but not SPF. A phisher discovers your domain and sends out hundreds of emails claiming to be from your company, but using their own mail server. Because you didn’t set up SPF, the receiving mail servers have no way of knowing that this mail server *isn’t* authorized to send emails from your domain. Although DKIM will likely fail (since the phisher can’t sign with your private key), some less strict email systems might still deliver the message, potentially causing damage. Example 2: How DKIM Prevents Tampering Let’s say you send an email that *passes* SPF. However, somewhere between your server and the recipient’s, the email is intercepted and altered. Because you implemented DKIM, the recipient server can verify the email’s DKIM signature. Since the email was tampered with, the signature will no longer match the content, causing the DKIM check to fail. This alerts the recipient that the email may not be trustworthy. Expert Tip: “Think of SPF, DKIM, and DMARC as a three-legged stool. Each protocol plays a vital role in ensuring email authentication. If one leg is missing or weak, the entire structure is compromised.”

SPF Configuration: Letting the World Know You’re Legit

How to avoid spam filters email marketing - A screenshot showing an example SPF record in a DNS management interface, highlighting the key components of the record.
Configuring SPF involves creating a TXT record in your domain’s DNS settings. This record specifies which mail servers are permitted to send emails on behalf of your domain. The syntax can seem a bit daunting at first, but it’s actually quite straightforward once you understand the basic components. The general structure of an SPF record is: v=spf1 [mechanisms] [modifiers] Let’s break down each component:
  • v=spf1: This indicates the SPF version being used (always spf1). It’s mandatory.
  • Mechanisms: These define the authorized senders. Common mechanisms include:
    • ip4: Allows specific IPv4 addresses or ranges. Example: ip4:192.0.2.0/24
    • ip6: Allows specific IPv6 addresses or ranges. Example: ip6:2001:db8::/32
    • a: Allows the IP addresses of the A record(s) for a specific domain. Example: a:example.com
    • mx: Allows the IP addresses of the MX record(s) for a specific domain. Example: mx:example.com
    • include: Includes the SPF record of another domain. Example: include:servers.net (This is critical for third-party sending services)
    • all: Specifies what to do with emails that don’t match any of the previous mechanisms. Common options: -all (hard fail, reject), ~all (soft fail, mark as suspicious), +all (allow all, which defeats the purpose of SPF!)
  • Modifiers: These provide additional instructions. The most common modifier is:
    • redirect: Specifies another domain’s SPF record to use. Rarely used. Example: redirect=example.com
Example 1: Basic SPF record for a single mail server. If your mail server’s IP address is 203.0.113.45, your SPF record might look like this:
v=spf1 ip4:203.0.113.45 -all
This record tells receiving servers that only emails originating from the IP address 203.0.113.45 are authorized to send emails on behalf of your domain. Any other server attempting to send emails from your domain should be rejected. Example 2: Using SPF with Google Workspace (G Suite) If you use Google Workspace (formerly G Suite) to send emails, you need to include Google’s SPF record. Your SPF record would look like this:
v=spf1 include:_spf.google.com -all
The include:_spf.google.com mechanism tells receiving servers to consult Google’s SPF record for a list of authorized senders. Example 3: SPF record with multiple senders (Mail Server and Marketing Platform) If you use both your own mail server (203.0.113.45) and a marketing platform like Mailchimp, your SPF record would need to include both:
v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all
Important Considerations:
  • The 10-Lookup Limit: SPF records have a limit of 10 DNS lookups. This limit is easily exceeded by using too many include statements. Be mindful of nested include statements within the included SPF records. Flouting this rule can cause SPF to fail, regardless of whether your email *should* have passed SPF authentication.
  • Avoid +all: Using +all in your SPF record effectively disables SPF, as it allows any server to send emails on behalf of your domain. This is highly discouraged and will likely lead to your emails being flagged as spam.
  • Use -all or ~all: The -all (hard fail) directive is generally preferred, as it tells receiving servers to reject emails that don’t match your SPF record. ~all (soft fail) marks emails as suspicious but doesn’t necessarily reject them.
  • Always Test Your SPF Record: After creating or modifying your SPF record, use online tools (e.g., MXToolbox SPF Record Check, Dmarcian’s SPF Surveyor) to validate its syntax and ensure it’s working correctly.
Example of checking SPF record using `dig` command:
dig +short TXT example.com
Expected output:
"v=spf1 ip4:203.0.113.45 include:servers.mcsv.net -all"
This command queries the DNS server for the TXT record of `example.com` and displays its content. The output shows the SPF record configured for the domain.

“A properly configured SPF record is the foundation of email authentication. Without it, your emails are significantly more likely to end up in the spam folder, regardless of your DKIM and DMARC setup.” John Doe, Email Deliverability Expert

DKIM Implementation: Digitally Signing Your Emails

DKIM provides a way to cryptographically sign your emails, allowing receiving servers to verify that the message hasn’t been altered during transit and that it truly originated from your domain. Implementing DKIM involves generating a public/private key pair, configuring your mail server to sign outgoing emails using the private key, and publishing the public key in your DNS records. Generating DKIM Keys The process of generating DKIM keys varies depending on your mail server software. Here are examples for common platforms:
  • Postfix: You can use the opendkim package to generate DKIM keys.
  • Sendmail: Similar to Postfix, you can use opendkim.
  • Microsoft Exchange: Exchange Server has built-in DKIM functionality. Configuration varies by version.
  • Cloud-Based Email Providers: Most cloud-based email marketing services (e.g., Mailchimp, SendGrid, Amazon SES) provide their own DKIM key generation and management tools. Consult their documentation for specific instructions.
Example: Generating DKIM keys with OpenDKIM (Linux)
opendkim-genkey -t -d example.com -s mail
This command generates a private key (`mail.private`) and a public key (`mail.txt`) for the domain `example.com` with the selector `mail`. The selector is a name you choose to identify the specific DKIM key pair you are using. You might have multiple DKIM keys for different purposes or services. Expected Output (mail.txt):
mail._domainkey.example.com. IN      TXT     "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This output is the TXT record you’ll need to add to your DNS settings. The “p=” value contains the public key. Configuring Your Mail Server After generating the DKIM keys, you need to configure your mail server to use the private key to sign outgoing emails. This involves modifying your mail server’s configuration files. Example: Configuring Postfix with OpenDKIM 1. Install the `opendkim` and `opendkim-tools` packages:
sudo apt-get install opendkim opendkim-tools
2. Edit the `/etc/opendkim.conf` file:
sudo nano /etc/opendkim.conf
Add/modify the following lines:
Domain          example.com
Selector        mail
KeyFile         /etc/opendkim/keys/mail.private
Socket          inet:8891@localhost
3. Create the directory for the DKIM keys and move the private key:
sudo mkdir -p /etc/opendkim/keys
sudo mv mail.private /etc/opendkim/keys/
sudo chown opendkim:opendkim /etc/opendkim/keys/mail.private
sudo chmod 600 /etc/opendkim/keys/mail.private
4. Edit `/etc/default/opendkim` and uncomment the following line:
SOCKET="inet:8891@localhost"
5. Configure Postfix to use OpenDKIM by adding the following to `/etc/postfix/main.cf`:
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
6. Restart Postfix and OpenDKIM:
sudo systemctl restart opendkim
sudo systemctl restart postfix
Adding the DKIM Public Key to Your DNS Records The final step is to add the public key to your domain’s DNS records. This is done by creating a TXT record with the selector and domain name. Example: Adding the DKIM record Using the public key from the previous example, create a TXT record with the following settings:
  • Name/Host: `mail._domainkey.example.com`
  • Type: TXT
  • Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
Important Considerations:
  • Selector: The selector is used to differentiate between multiple DKIM keys. Choose a descriptive selector (e.g., `mail`, `smtp`, `marketing`).
  • Key Length: Use a strong key length (at least 2048 bits) for better security.
  • Regular Key Rotation: Periodically rotate your DKIM keys to minimize the impact of a potential key compromise.
  • Testing: After configuring DKIM, send a test email to a service like Gmail or Mail-Tester to verify that the DKIM signature is valid.
Example of checking DKIM record using `dig` command:
dig +short TXT mail._domainkey.example.com
Expected output (truncated for brevity):
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+..."
This command queries the DNS server for the TXT record of `mail._domainkey.example.com` and displays its content, which should match the public key you configured.

DMARC Policy: Defining How to Handle Unauthenticated Emails

DMARC acts as the policy enforcer for SPF and DKIM. It allows you to tell receiving mail servers what to do with emails that fail SPF and/or DKIM authentication checks. This is crucial for protecting your domain from spoofing and phishing attacks. Furthermore, DMARC provides valuable reporting, enabling you to monitor your email authentication setup and identify potential issues. A DMARC record is another TXT record added to your DNS settings, with the name `_dmarc.yourdomain.com`. It defines your policy and specifies where to send reports. The general structure of a DMARC record is:
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
  • v=DMARC1: This indicates the DMARC version being used (always DMARC1). It’s mandatory.
  • p=[policy]: This defines the policy to apply to emails that fail SPF and/or DKIM checks. Possible values:
    • none: Monitor only. Receiving servers take no specific action. This is the recommended starting point.
    • quarantine: Instruct receiving servers to send failing emails to the spam folder.
    • reject: Instruct receiving servers to reject failing emails outright.
  • Options: These provide additional instructions and reporting options. Common options include:
    • rua: Specifies an email address to send aggregate reports (daily summaries of authentication results). Example: rua=mailto:dmarc-reports@example.com
    • ruf: Specifies an email address to send forensic reports (detailed information about individual failing emails). Use with caution, as these reports can contain sensitive information. Example: ruf=mailto:forensic-reports@example.com
    • adkim: Alignment mode for DKIM. Possible values: r (relaxed, default) or s (strict).
    • aspf: Alignment mode for SPF. Possible values: r (relaxed, default) or s (strict).
    • pct: Percentage of failing emails to which the policy should be applied. Used for gradual rollout. Example: pct=50 (apply policy to 50% of failing emails).
    • fo: Forensic report options. Specifies when to generate forensic reports.
Example 1: DMARC record for monitoring only (p=none)
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to send aggregate reports to dmarc-reports@example.com but not to take any specific action on failing emails. This allows you to gather data and identify potential issues before implementing a stricter policy. Example 2: DMARC record for quarantining failing emails (p=quarantine)
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to send emails that fail SPF and/or DKIM checks to the recipient’s spam folder. This is a more aggressive policy than p=none, but still allows recipients to access the emails if needed. Example 3: DMARC record for rejecting failing emails (p=reject)
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
This record tells receiving servers to reject emails that fail SPF and/or DKIM checks outright. This is the strictest policy and provides the strongest protection against spoofing, but it’s crucial to ensure your email authentication is properly configured before implementing this policy, as legitimate emails may be rejected if not properly authenticated. Example 4: DMARC record with percentage rollout (pct=50)
v=DMARC1; p=quarantine; pct=50; rua=mailto:dmarc-reports@example.com
This record instructs receiving servers to quarantine 50% of emails that fail SPF and/or DKIM checks. This allows you to gradually roll out your DMARC policy and monitor the impact on your email deliverability. Important Considerations:
  • Start with p=none: Always begin with a p=none policy to monitor your email authentication setup and identify any legitimate emails that may be failing authentication.
  • Analyze Reports: Regularly analyze the aggregate reports (rua) to identify any issues and adjust your SPF, DKIM, and DMARC configuration accordingly.
  • Gradual Rollout: After monitoring for a period of time, gradually increase the policy to p=quarantine and then to p=reject, while continuously monitoring the reports.
  • Alignment Modes: Understand the difference between relaxed (r) and strict (s) alignment modes for DKIM and SPF. Strict alignment requires that the domain used in the DKIM signature or the SPF HELO/MAIL FROM matches the domain in the From: header. Relaxed alignment is more forgiving.
  • Subdomain Policies (sp tag, if needed): You can define a separate policy for subdomains using the `sp` tag, but it’s not always necessary.
Example of checking DMARC record using `dig` command:
dig +short TXT _dmarc.example.com
Expected Output:
"v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
This command queries the DNS server for the TXT record of `_dmarc.example.com` and displays the configured DMARC record. “DMARC is not a ‘set it and forget it’ solution. Continuous monitoring and analysis of reports are essential for maintaining effective email authentication and protecting your brand.”

Testing and Monitoring Your Email Authentication Setup

Implementing SPF, DKIM, and DMARC is only the first step. It’s crucial to regularly test and monitor your email authentication setup to ensure it’s working correctly and to identify any potential issues. Testing helps to identify configuration errors, while monitoring allows you to track your email deliverability and detect potential spoofing attempts. Testing Tools and Techniques
  • Mail-Tester: This is a popular online tool that provides a detailed analysis of your email’s authentication, spam score, and other factors affecting deliverability. Send a test email to the provided address, and it will generate a report with actionable recommendations.
  • Gmail’s “Show Original”: In Gmail, you can view the headers of an email by clicking the three dots in the upper-right corner and selecting “Show original.” This allows you to examine the SPF, DKIM, and DMARC results directly. Look for the “Authentication-Results” header.
  • MXToolbox: MXToolbox offers a suite of tools for diagnosing DNS and email-related issues, including SPF record check, DKIM record check, and DMARC record check.
  • Dmarcian’s DMARC Inspector: Dmarcian offers tools specifically designed for DMARC, including a DMARC record generator and a DMARC inspector that analyzes your DMARC record and provides recommendations for improvement.
Example 1: Using Mail-Tester 1. Go to Mail-Tester.com 2. You’ll see a unique email address displayed on the page. 3. Send a test email from your email server to that address. 4. Click the “Then check your score” button. 5. Mail-Tester will analyze your email and provide a score out of 10, along with detailed information about SPF, DKIM, DMARC, spam score, and other factors. Example 2: Checking Authentication-Results in Gmail 1. Open an email you sent from your domain in Gmail. 2. Click the three dots in the upper-right corner and select “Show original.” 3. Look for the “Authentication-Results” header. It will contain information about the SPF, DKIM, and DMARC results.
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of sender@example.com designates 203.0.113.45 as permitted sender) smtp.mailfrom=sender@example.com;
       dkim=pass header.i=@example.com header.s=mail header.b=...;
       dmarc=pass (p=quarantine sp=none dis=none) d=example.com
In this example, SPF, DKIM, and DMARC all passed. Monitoring DMARC Reports DMARC reports are essential for understanding how your emails are being authenticated and for identifying any potential issues. These reports provide valuable insights into your email traffic, including:
  • The number of emails sent from your domain
  • The SPF and DKIM authentication results for those emails
  • The actions taken by receiving servers based on your DMARC policy (e.g., none, quarantine, reject)
  • The sources of email traffic claiming to be from your domain
There are two types of DMARC reports:
  • Aggregate Reports (RUA): These are daily summaries of authentication results, providing an overview of your email traffic and authentication performance. They are typically sent in XML format.
  • Forensic Reports (RUF): These provide detailed information about individual emails that failed authentication. They can be useful for identifying and investigating spoofing attempts, but should be handled with caution due to privacy concerns.
Analyzing DMARC reports manually can be challenging due to their XML format. Several DMARC reporting services and tools can help you visualize and analyze your DMARC data, including:
  • Dmarcian: Provides a comprehensive DMARC reporting platform with advanced analytics and visualization tools.
  • Postmark: Offers DMARC monitoring and reporting as part of their email delivery service.
  • EasyDMARC: Provides a user-friendly DMARC reporting solution with a focus on simplicity and ease of use.
By regularly monitoring your DMARC reports, you can identify:
  • Legitimate email sources that are not properly authenticated (e.g., a new marketing platform or a misconfigured mail server).
  • Spoofing attempts and phishing attacks targeting your domain.
  • Configuration errors in your SPF, DKIM, or DMARC records.
Example: Analyzing DMARC Aggregate Report (XML) A DMARC aggregate report is an XML file. Here’s a snippet:
<feedback>
  <report_metadata>
    <org_name>Google</org_name>
    <email>noreply-dmarc-support@google.com</email>
    <report_id>1234567890</report_id>
    <date_range>
      <begin>1678886400</begin>
      <end>1678972800</end>
    </date_range>
  </report_metadata>
  <policy_published>
    <domain>example.com</domain>
    <adkim>r</adkim>
    <aspf>r</aspf>
    <p>quarantine</p>
    <sp>none</sp>
    <pct>100</pct>
  </policy_published>
  <record>
    <row>
      <source_ip>203.0.113.45</source_ip>
      <count>100</count>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>pass</spf>
      </policy_evaluated>
    </row>
  </record>
</feedback>
Key elements to analyze:
  • source_ip: The IP address from which the email originated.
  • count: The number of emails from that IP address.
  • dkim: The DKIM result (pass or fail).
  • spf: The SPF result (pass or fail).
  • disposition: The action taken by the receiving server (none, quarantine, reject).
By analyzing these elements, you can identify potential issues and adjust your email authentication configuration accordingly. For instance,

Share this article