DRIT.Mail 26.7.878

dotnet add package DRIT.Mail --version 26.7.878
                    
NuGet\Install-Package DRIT.Mail -Version 26.7.878
                    
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="DRIT.Mail" Version="26.7.878" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DRIT.Mail" Version="26.7.878" />
                    
Directory.Packages.props
<PackageReference Include="DRIT.Mail" />
                    
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 DRIT.Mail --version 26.7.878
                    
#r "nuget: DRIT.Mail, 26.7.878"
                    
#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 DRIT.Mail@26.7.878
                    
#: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=DRIT.Mail&version=26.7.878
                    
Install as a Cake Addin
#tool nuget:?package=DRIT.Mail&version=26.7.878
                    
Install as a Cake Tool

DRIT.Mail

Pure-Managed .NET Mail File-Format and Message-Security Library

Read, Write, Convert, Sign, and Verify Outlook/Exchange Mail Formats

DRIT.Mail is a pure-managed .NET library for reading, writing, converting, signing, encrypting, and verifying Outlook/Exchange mail file formats — MSG, PST, EML, iCalendar, vCard, and MBOX — with a first-class, source-level RFC implementation layer (MIME, S/MIME, DKIM, CMS, ASN.1, X.509, DNS, SMTP, POP3, IMAP).

Key Benefits

  • Zero external dependencies – pure managed C# implementation, no Outlook installation required
  • MAPI object model at the core – a message is a MapiMessage regardless of storage backend
  • Cross-format conversion in one line – MSG ↔ PST ↔ EML ↔ iCal ↔ vCard
  • Deep format fidelity – full PST NDB/LTP layer, in-house OLE Compound File engine
  • Self-contained crypto stack – S/MIME and DKIM with no System.Security.Cryptography.Pkcs dependency
  • DKIM verification (not just signing) with a built-in DNS client

Cross-Platform Mail Library

DRIT.Mail targets .NET Standard 2.0 and .NET Framework 4.8, so it runs on:

  • Operating Systems: Windows, Linux, macOS
  • Frameworks: .NET Standard 2.0, .NET Framework 4.8+, .NET Core / .NET 5+
  • Dependencies: None – all functionality is built-in

Features

File Format I/O

  • MSG (Outlook Item) – read/write via in-house OLE Compound File engine ([MS-OXMSG])
  • PST (Personal Folders) – read/write with full NDB/LTP layer, ANSI/Unicode/Unicode-4k ([MS-PST])
  • EML (Internet Message) – read/write via first-class MIME implementation (RFC 5322/2045–2049)
  • MBOX (Mailbox Archive) – read/write, streaming, mboxrd (RFC 4155)
  • ICS (iCalendar) – read/write with full component support (RFC 5545)
  • VCF (vCard) – read/write, versions 2.1/3.0/4.0 (RFC 6350/2426)
  • TNEF (winmail.dat) – parse

MAPI Object Model

  • MapiMessage, MapiContact, MapiAppointment, MapiTask, MapiJournal, MapiNote, MapiMeeting, MapiRss
  • Full MAPI property system – every PidTag* tag, named properties (GUID + string), multi-value properties
  • RTF body (MS-OXRTFCP compressed, decompressed on read)
  • Attachments – file, inline (Content-ID), embedded messages (AttachMethod == 5)

Cross-Format Conversion

14 conversion paths via the MailMessageConverter facade:

  • PST ↔ MSG, MSG/PST ↔ EML, EML → MSG/PST
  • MSG/PST ↔ iCal, MSG/PST ↔ vCard

Protocol Clients

  • SMTP (RFC 5321) – STARTTLS, implicit TLS, SASL, XOAUTH2, pipelining, mass sending, DKIM integration
  • POP3 (RFC 1939) – USER/PASS, APOP, SASL, STLS, implicit TLS, UIDL
  • IMAP (RFC 9051/3501) – LOGIN + SASL, XOAUTH2, SELECT/EXAMINE, LIST/CREATE/DELETE/RENAME, FETCH, STORE, COPY/MOVE, SEARCH, IDLE, STATUS

Message Security

  • S/MIME (RFC 5751) – sign (detached + opaque), verify, encrypt (AES-CBC + RSA), decrypt
  • DKIM (RFC 6376) – sign and verify with built-in DNS client for key lookup
  • CMS (RFC 5652), ASN.1 DER, X.509 – self-contained, no System.Security.Cryptography.Pkcs dependency
  • DNS client (RFC 1035) – TXT record resolution for DKIM key lookup

Additional Capabilities

  • PST search folders (SUD) and client-side content search
  • File structure validation (PST, MSG, OLE Compound)
  • Message comparison (property-level diffing)

Supported File Formats

Format Description Read Write
MSG Outlook Item (OLE Compound) ✔️ ✔️
PST Outlook Personal Folders (ANSI/Unicode/4k) ✔️ ✔️
EML Internet Email (RFC 5322/MIME) ✔️ ✔️
MBOX Mailbox Archive (RFC 4155) ✔️ ✔️
ICS iCalendar (RFC 5545) ✔️ ✔️
VCF vCard (RFC 6350/2426) ✔️ ✔️
HTML Rendered Message Body ✔️
OFT Outlook Template ✔️ ✔️
TNEF winmail.dat ✔️

Installation

1. Install via NuGet

  • Open Microsoft Visual Studio and the NuGet package manager
  • Search for "DRIT.Mail"
  • Click Install to download and reference it in your project

2. Install via Package Manager Console

Install-Package DRIT.Mail

3. Install via .NET CLI

dotnet add package DRIT.Mail

Code Examples

Load and Convert a Message

using DRIT.Mail;

// Auto-detect format from the extension and load.
IMailMessage message = MailFile.Load("input.eml");

// Convert to MSG — one line, regardless of source format.
message.Save("output.msg", MailMessageFormat.Msg);

// Access the underlying MAPI object model.
MapiMessage mapi = message.MapiMessage;
Console.WriteLine("Subject: {0}", mapi.Subject);
foreach (MapiRecipient recipient in mapi.Recipients)
    Console.WriteLine("  {0}: {1}", recipient.RecipientType, recipient.EmailAddress);

Read a PST File

using DRIT.Mail;
using DRIT.Mail.Pst.PhysicalLayout;

PstFile pst = MailFile.OpenPst("archive.pst");

// Walk the folder hierarchy and export every message to MSG.
CompositeFolder root = pst.Folders.RootCompositeFolder;
foreach (CompositeFolder folder in root.GetDepthFirstFolderEnumerator())
{
    Console.WriteLine("Folder: {0}", folder.Folder.DisplayName);
    foreach (PstMapiMessage item in folder.GetMapiMessages())
        MailFile.Save(item, $"{item.Subject}.msg", MailMessageFormat.Msg);
}

Send a Message via SMTP

using DRIT.Mail.Rfc.Mime;
using DRIT.Mail.Rfc.Smtp;
using DRIT.Mail.Rfc.Smtp.Auth;

MimeMessage message = new MimeMessageBuilder()
    .From(new MailboxAddress("sender@example.com"))
    .To(new MailboxAddress("recipient@example.com"))
    .Subject("Hello from DRIT.Mail")
    .TextBody("This message was created and sent with DRIT.Mail.")
    .Build();

var options = new SmtpClientOptions("smtp.example.com", 587)
{
    Credentials = new SmtpCredentials("user", "password"),
    SslMode = SmtpSslMode.Auto,
};

using (var smtp = new SmtpClient(options))
{
    SmtpDeliveryResult result = smtp.Send(message);
    Console.WriteLine("Delivered: {0}", result.IsSuccessful);
}

Receive and Search via IMAP

using DRIT.Mail.Rfc.Imap;
using DRIT.Mail.Rfc.Sasl;

var options = new ImapClientOptions("imap.example.com", 993)
{
    Credentials = new SaslCredentials("user", "password"),
    SslMode = ImapSslMode.Auto,
};

using (var imap = new ImapClient(options))
{
    imap.Connect();
    imap.Authenticate();
    imap.SelectFolder("INBOX");

    // Server-side search: unseen messages since 2026-01-01.
    var criteria = ImapSearchCriteria.Create()
        .Unseen()
        .Since(new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero));

    foreach (long uid in imap.Search(criteria))
    {
        MimeMessage message = imap.FetchMessage(
            ImapMessageSet.FromUids(new[] { uid }),
            ImapFetchOptions.Body);
        Console.WriteLine("[{0}] {1}", uid, message.Subject);
    }
}

S/MIME Sign and Verify

using DRIT.Mail.Rfc.SMime;
using DRIT.Mail.Rfc.Crypto.X509;

var certInfo = X509CertificateReader.ReadFromPem(File.ReadAllText("signer.pem"));
var signer = new SMimeSigner(new SMimeSignerOptions
{
    SignerCertificate = certInfo.Certificate,
    PrivateKey = certInfo.RsaPrivateKey,
    DigestAlgorithm = DigestAlgorithm.Sha256,
});

// Sign (detached / clear-signed produces multipart/signed).
MimeMessage signed = signer.SignDetached(message);

// Verify.
var verifier = new SMimeVerifier();
SMimeVerificationResult result = verifier.Verify(signed);
Console.WriteLine("Valid: {0}", result.IsValid);

System Requirements

  • Target Frameworks: .NET Standard 2.0, .NET Framework 4.8+
  • Dependencies: None – all mail, crypto, and protocol functionality is built-in

© 2026 DR-IT Ltd. All Rights Reserved.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
26.7.878 36 7/30/2026

- Initial NuGet release.