<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).
- 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.
<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).
- 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.
- 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.
<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).
- 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.
- 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.
- 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.
<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).
- 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
- 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.
- 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.
- 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.
<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).
- 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
- 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.
- 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.
- 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.
<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).
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
- 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.
- 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.
- 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.
<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).
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
- 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.
- 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.
- 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.
<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).
"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.
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
- 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.
- 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.
- 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.
<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).
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.
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
- 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.
- 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.
- 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.
<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).
- Start with
p=none
: Always begin with ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
v=DMARC1; p=[policy]; [options]
Let’s break down the components:
v=DMARC1
: This indicates the DMARC version being used (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
"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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
- Name/Host: `mail._domainkey.example.com`
- Type: TXT
- Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
- Name/Host: `mail._domainkey.example.com`
- Type: TXT
- Value: `v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwV94+…` (the full public key)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
- 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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
"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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
SPF Configuration: Letting the World Know You’re Legit

v=spf1 [mechanisms] [modifiers]
Let’s break down each component:
v=spf1
: This indicates the SPF version being used (alwaysspf1
). 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
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
SPF Configuration: Letting the World Know You’re Legit

v=spf1 [mechanisms] [modifiers]
Let’s break down each component:
v=spf1
: This indicates the SPF version being used (alwaysspf1
). 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
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).
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
- SPF Configuration: Letting the World Know You’re Legit
- DKIM Implementation: Digitally Signing Your Emails
- DMARC Policy: Defining How to Handle Unauthenticated Emails
- Testing and Monitoring Your Email Authentication Setup
Understanding Email Authentication: SPF, DKIM, and DMARC

- 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.
SPF Configuration: Letting the World Know You’re Legit

v=spf1 [mechanisms] [modifiers]
Let’s break down each component:
v=spf1
: This indicates the SPF version being used (alwaysspf1
). 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
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 nestedinclude
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.
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.
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)
- 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.
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 (alwaysDMARC1
). 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) ors
(strict).aspf
: Alignment mode for SPF. Possible values:r
(relaxed, default) ors
(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.
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 ap=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 top=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.
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.
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
- 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.
- 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.
- 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.
<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).