• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Compare Messages

Compares two MAPI messages and reports the differences.

Code

using DRIT.Mail;
using DRIT.Mail.Comparison;

IMailMessage a = MailFile.Load("message_v1.msg");
IMailMessage b = MailFile.Load("message_v2.msg");

var comparer = new MailMessageComparer();
MailMessageDifferences differences = comparer.Compare(a.MapiMessage, b.MapiMessage);

if (differences.IsValid)
{
    Console.WriteLine("The messages are identical.");
}
else
{
    Console.WriteLine($"Found {differences.Differences.Count} difference(s):");
    foreach (string diff in differences.Differences)
    {
        Console.WriteLine($"  - {diff}");
    }
}

Remarks

MailMessageComparer compares subject, body, HTML body, message class, sender, recipient count, and attachment count. The MailMessageDifferences result exposes a list of human-readable difference descriptions.

  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX