DMARCForensicParser 1.2.0

dotnet add package DMARCForensicParser --version 1.2.0
                    
NuGet\Install-Package DMARCForensicParser -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DMARCForensicParser" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DMARCForensicParser" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="DMARCForensicParser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DMARCForensicParser --version 1.2.0
                    
#r "nuget: DMARCForensicParser, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DMARCForensicParser@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DMARCForensicParser&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=DMARCForensicParser&version=1.2.0
                    
Install as a Cake Tool

DMARCForensicParser

A .NET library for reading DMARC failure reports(rfc6591).

Overview

DMARCForensicParser is a .NET library for parsing DMARC forensic reports. It extracts key details from reports, including report headers, body, feedback-report, the original emails headers and body.

Features

  • Parses forensic reports from email streams
  • Extracts headers, body form the report email.
  • Parses message/feedback-report (detail about the failed authentication)
  • Parses message/rfc822(original email)

Installation

To install the library in your .NET project, use:

Install-Package DMARCForensicParser

Usage

1. Import the Library

using DMARCForensicParser;
using System.IO;

2. Read and Parse a Forensic Report

ForensicReportReader reader = new ForensicReportReader();
using (FileStream stream = File.OpenRead("forensic_report.eml"))
{
    Result result = reader.ReadForensicReport(stream);
    Console.WriteLine($"From: {result.From}");
    Console.WriteLine($"To: {result.To}");
    Console.WriteLine($"Date: {result.Date}");
    Console.WriteLine($"Report's email body: {result.EmailTextBody}");
    Console.WriteLine($"Authentication Results: {result.FeedbackReport.AuthenticationResults}");
    Console.WriteLine($"Source IP: {result.FeedbackReport.SourceIP}");
    Console.WriteLine($"Original email subject: {result.OriginalEmail.Subject}");
}

Classes & Data Structures

Result

Represents the output from the parser.

public class Result 
{
    public string MessageId { get; set; }
    public string From { get; set; }
    public string To { get; set; }
    public string Cc { get; set; }
    public DateTime Date { get; set; }
    public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
    public string EmailTextBody { get; set; } = "";
    public FeedbackReport FeedbackReport { get; set; }
    public RFC822 OriginalEmail { get; set; }
}

FeedbackReport

Represents the message/feedback-report extracted from the forensic report.

public class FeedbackReport
{
    public string UserAgent { get; set; }
    public string Version { get; set; }
    public string OriginalMailFrom { get; set; }
    public string OriginalEnvelopeId { get; set; }
    public DateTime? ArrivalDate { get; set; }
    public string AuthenticationResults { get; set; }
    public string SourceIP { get; set; }
    public string ReportedDomain { get; set; }
    public string ReportedURI { get; set; }
    public string DeliveryResult { get; set; }
    public string AuthFailure { get; set; }
    public string DKIMDomain { get; set; }
    public string DKIMIdentity { get; set; }
    public string DKIMSelector { get; set; }
    public string DKIMCanonicalizedHeader { get; set; }
    public string DKIMCanonicalizedBody { get; set; }
    public string DKIMSelectorDNS { get; set; }
    public string SPFDNS { get; set; }
}

RFC822

Represents the rfc-822(original email) details extracted from the forensic report.

public class RFC822 
{
    public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
    public string ContentType { get; set; }
    public string Subject { get; set; }
    public string Cc { get; set; }
    public string Bcc { get; set; }
    public string From { get; set; }
    public string To { get; set; }
    public string MessageId { get; set; }
    public string ReplyTo { get; set; }
    public string InReplyTo { get; set; }
    public DateTime DateTime { get; set; }
    public string EmailTextBody { get; set; }
}

Github: https://github.com/adil62/DMARCForensicParser

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 210 5/7/2025
1.1.0 154 3/2/2025
1.0.0 173 2/10/2025