DMARC Report Converter and Emailer - n8n Workflow

Automate DMARC report processing using this n8n workflow. Scheduled daily, it fetches compressed XML reports via Gmail, transforms them into readable HTML tables, and emails the results.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • System administrators or DevOps engineers responsible for email security and deliverability.

  • Businesses needing an automated, readable summary of their DMARC compliance.

  • Users looking for advanced examples of data transformation and file handling within an n8n workflow.

  • Anyone seeking ready-to-use n8n templates for complex scheduled tasks.

Overview

Managing DMARC reports can be cumbersome; major providers like Google and Yahoo send them as compressed XML files (often GZ or ZIP) attached to emails, which are inherently difficult to read and analyze quickly. This powerful n8n workflow solves this problem by completely automating the entire process.

Starting with an n8n trigger, the system regularly queries Gmail, identifies the DMARC reports, and downloads the binary attachments. It then uses several sequential n8n node operations to decompress the file, parse the complex XML data, and convert it into structured JSON. Finally, the n8n node uses sophisticated templating to render the critical information (like source IP, pass/fail status for DKIM/SPF, and count) into a clean, summarized HTML table. This readable table is then delivered directly to your inbox using a final Gmail n8n node, turning complex data into actionable insight immediately. This specific n8n workflow demonstrates advanced file manipulation and data parsing techniques.

How it Works

This n8n workflow is initiated by a schedule, ensuring daily processing of new reports.


  1. Scheduled Trigger: The process begins with the cron n8n trigger, set to run daily at 1 PM.

  2. Fetch Reports (Gmail n8n node): The dmarc n8n node (a Gmail node) searches for emails matching a specific filter (from:([email protected] OR [email protected])) received within the last 24 hours. Crucially, it is configured to download all attachments.

  3. Decompression: The unzip n8n node handles the binary data, decompressing the attached DMARC file (which could be .zip or .gz) and passing the resulting XML file forward.

  4. XML Extraction: The xml n8n node extracts the actual XML content from the binary file, preparing the data for structure conversion.

  5. XML to JSON Conversion: The xml2json n8n node converts the verbose XML structure into a manageable JSON object, making it easy to reference specific data points.

  6. HTML Templating (Set n8n node): The set n8n node is the core logic engine. It uses complex n8n expressions and conditional logic to iterate through the DMARC records in the JSON and compile them into a visually appealing HTML table, including key metrics like source IP, policy evaluation (DKIM/SPF), and message count.

  7. Send Summarized Report (Gmail n8n node): The final send n8n node emails the generated HTML table as the message body. The email subject is dynamically created using data parsed in step 5, providing context like the reporting organization and the domain covered by the report. This completes the n8n workflow, delivering a clean report.

Installation Guide

To install and utilize this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON code and import it directly into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Gmail Credentials: This n8n workflow requires two separate Gmail n8n node configurations (one for fetching and one for sending). You will need a single set of OAuth2 credentials configured in n8n for Gmail.

  3. Configure Fetcher: In the dmarc n8n node, ensure your Gmail credentials are selected. The filter query is pre-set, but verify it matches the source of your DMARC reports.

  4. Configure Sender: In the send n8n node, select the same Gmail credentials. Crucially, update the Send To field to your desired recipient email address.

  5. Review Schedule: Review the cron n8n trigger to ensure the daily execution time (currently 1 PM) suits your reporting needs.

  6. Activate: Save and activate the n8n workflow. It will automatically run at the scheduled time.

Node Details

cron (Schedule Trigger): The starting n8n trigger, set for daily execution at 13:00 (1 PM).
dmarc (Gmail n8n node): Configured to perform the getAll operation. It downloads attachments and uses a specific query (from:([email protected] OR [email protected])) to filter only DMARC reports received recently.
unzip (Compression n8n node): Targets the binary property attachment0 to decompress the received zipped or gzipped report file.
xml (Extract From File n8n node): Extracts the text content from the binary output of the previous n8n node, specifying the operation as xml.
xml2json (XML n8n node): Converts the extracted XML document into a standardized JSON data structure, making the data accessible via expressions in the subsequent n8n node.
set (Set n8n node): This crucial n8n node uses extensive Javacript expressions and HTML formatting to build the final, readable table content, mapping JSON elements (like source
ip, count, policyevaluated.dkim, policyevaluated.spf) into HTML table rows.


  • send (Gmail n8n node): The final action. It uses the content created by the set n8n node as the email body and dynamically generates a subject line using expressions referencing the original DMARC metadata (e.g., {{ $('xml2json').item.json.feedback.reportmetadata.orgname }} DMARC Report).

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Coder.

Featured*