MsgKit 2.8.1

dotnet add package MsgKit --version 2.8.1                
NuGet\Install-Package MsgKit -Version 2.8.1                
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="MsgKit" Version="2.8.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MsgKit --version 2.8.1                
#r "nuget: MsgKit, 2.8.1"                
#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.
// Install MsgKit as a Cake Addin
#addin nuget:?package=MsgKit&version=2.8.1

// Install MsgKit as a Cake Tool
#tool nuget:?package=MsgKit&version=2.8.1                

What is MsgKit?

MsgKit is a 100% managed C# .NET 4.6.2, .NET Standard 2.0 and .NET Standard 2.1 assembly (no PINVOKE or whatsoever) which may be used for the creation of messages (E-Mail, Appointments, Journals and Stickey Notes) that are Outlook compatible

License Information

MsgKit is Copyright (C) 2015-2024 Kees van Spelde (Magic-Sessions) and is licensed under the MIT license:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Installing via NuGet

NuGet

The easiest way to install MsgKit is via NuGet.

In Visual Studio's Package Manager Console, simply enter the following command:

Install-Package MsgKit 

Creating an e-mail

using (var email = new Email(
        new Sender("peterpan@neverland.com", "Peter Pan"),
        new Representing("tinkerbell@neverland.com", "Tinkerbell"),
        "Hello Neverland subject"))
{
    email.Recipients.AddTo("captainhook@neverland.com", "Captain Hook");
    email.Recipients.AddCc("crocodile@neverland.com", "The evil ticking crocodile");
    email.Subject = "This is the subject";
    email.BodyText = "Hello Neverland text";
    email.BodyHtml = "<html><head></head><body><b>Hello Neverland html</b></body></html>";
    email.Importance = MessageImportance.IMPORTANCE_HIGH;
    email.IconIndex = MessageIconIndex.ReadMail;
    email.Attachments.Add(@"d:\crocodile.jpg");
    email.Save(@"c:\email.msg");

    // Show the E-mail
    System.Diagnostics.Process.Start(@"c:\Email.msg");
}

Creating an Appointment

using (var appointment = new Appointment(
    new Sender("peterpan@neverland.com", "Peter Pan"),
    new Representing("tinkerbell@neverland.com", "Tinkerbell"),
    "Hello Neverland subject")) 
{
    appointment.Recipients.AddTo("captainhook@neverland.com", "Captain Hook");
    appointment.Recipients.AddCc("crocodile@neverland.com", "The evil ticking crocodile");
    appointment.Subject = "This is the subject";
    appointment.Location = "Neverland";
    appointment.MeetingStart = DateTime.Now.Date;
    appointment.MeetingEnd = DateTime.Now.Date.AddDays(1).Date;
    appointment.AllDay = true;
    appointment.BodyText = "Hello Neverland text";
    appointment.BodyHtml = "<html><head></head><body><b>Hello Neverland html</b></body></html>";
    appointment.SentOn = DateTime.UtcNow;
    appointment.Importance = MessageImportance.IMPORTANCE_NORMAL;
    appointment.IconIndex = MessageIconIndex.UnsentMail;
    appointment.Attachments.Add(@"d:\crocodile.jpg");
    appointment.Save(@"c:\appointment.msg");

    // Show the Appointment
    System.Diagnostics.Process.Start(@"c:\Appointment.msg");
}

Creating a contact card

using (var contact = new Contact(
    new Sender(SenderTextBox.Text, string.Empty),
    SubjectTextBox.Text,
    DraftMessageCheckBox.Checked,
    ReadReceiptCheckBox.Checked))
{
    contact.Recipients.AddTo("captainhook@neverland.com", "Captain Hook");
    contact.Recipients.AddCc("crocodile@neverland.com", "The evil ticking crocodile");
    contact.Subject = "This is the subject";
    contact.BodyText = "Hello Neverland text";
    contact.BodyHtml = "<html><head></head><body><b>Hello Neverland html</b></body></html>"
    contact.Importance = MessageImportance.IMPORTANCE_NORMAL;
    contact.FileUnder = "File under";
    contact.InstantMessagingAddress = "Instant messaging address";
    contact.Private = false;
    contact.BirthDay = DateTime.Now;
    contact.WeddingAnniversary = DateTime.Now;
    contact.Assistant = new ContactAssistant {Name = "Assistant name", TelephoneNumber = "Assistant telephone number"};
    contact.CallBackTelePhoneNumber = "callback telephone number";
    contact.CarTelePhoneNumber = "car telephone number";
    contact.ChildrensNames = new List<string> {"First child name", "Second child name", "Third child name"};
    contact.CompanyMain = new ContactCompanyMain { Name = "Company main name", TelephoneNumber = "Company main telephone number"};
    contact.DepartmentName = "Department name";
    contact.Generation = "Generation";
    contact.GivenName = "GivenName";
    contact.Initials = "Initials";
    contact.ISDNNumber = "ISDN number";
    contact.Language = "Language";
    contact.Location = "Location";
    contact.ManagerName = "Manager name";
    contact.MiddleName = "Middle name";
    contact.MobileTelephoneNumber = "Mobile telephone number";
    contact.NickName = "Nick name";
    contact.OfficeLocation = "Office location";
    contact.PersonalHomePage = "Personal home-page";
    contact.PostalAddress = "Postal address";
    contact.PrimaryFaxNumber = "Primary fax number";
    contact.PrimaryTelephoneNumber = "Primary telephone number";
    contact.Profession = "Profession";
    contact.RadioTelephoneNumber = "Radio telephone number";
    contact.SpouseName = "Spouse name";
    contact.SurName = "Sur name";
    contact.TelexNumber = "Telex number";
    contact.Title = "Title";
    contact.TTYTDDPhoneNumber = "TTYTDD phone number";
    contact.Email1 = new Address("email1@neverland.com", "email1");
    contact.Email2 = new Address("email2@neverland.com", "email2");
    contact.Email3 = new Address("email3@neverland.com", "email3");
    //contact.Fax1 = "fax1@1234567890";
    //contact.Fax2 = "fax2@1234567890";
    //contact.Fax3 = "fax3@1234567890";
    contact.OfficeTelephoneNumber = "Office telephone number";
    contact.InstantMessagingAddress = "Instant messaging address";
    contact.Yomi = new ContactYomi { CompanyName = "Yomi company name", FirstName = "Yomi first name", LastName = "Yomi last name"};

    contact.Work = new ContactWork
    {
        TelephoneNumber = "Contact telephone number",
        City = "Contact city",
        Country = "Contact country",
        CountryCode = "Contact country code",
        PostOfficeBox = "Contact post office box",
        PostalCode = "Contact postal code",
        Street = "Contact street",
        Address = "Contact\nBla bla\nBla die bla\nBLa die bla die bla"
    };

    contact.Business = new ContactBusiness
    {
        TelephoneNumber = "Business telephone number",
        FaxNumber = "Business fax number",
        HomePage = "Business home-page",
        City = "Business city",
        Country = "Business country",
        PostalCode = "Business postal code",
        State = "Business state",
        Street = "Business street",
        Address = "Business\nBla bla\nBla die bla\nBLa die bla die bla"
    };

    contact.Home = new ContactHome
    {
        TelephoneNumber = "Home telephone number",
        TelephoneNumber2 = "Home telephone number 2",
        FaxNumber = "Home faxnumber",
        City = "Home city",
        Country = "Home country",
        PostalCode = "Home postal code",
        State = "Home state",
        Street = "Home street",
        Address = "Home\nBla bla\nBla die bla\nBLa die bla die bla"
    };

    contact.Other = new ContactOther
    {
        TelephoneNumber = "Other telephone number",
        City = "Other city",
        Country = "Other country",
        PostalCode = "Other postal code",
        State = "Other state",
        Street = "Other street",
        Address = "Other\nBla bla\nBla die bla\nBLa die bla die bla"
    };

    contact.PagerTelephoneNumber = "Pager telephone number";
    contact.PostalAddressId = PostalAddressId.HOME_ADDRESS;

    contact.ContactPicture = File.ReadAllBytes("Images\\tinkerbell.jpg");
    contact.IconIndex = MessageIconIndex.UnsentMail;
    contact.Save("c:\\contact.msg");
    
    System.Diagnostics.Process.Start("c:\\Contact.msg");
}

Creating a task

using (var task = new MsgKit.Task(
           new MsgKit.Sender("peterpan@neverland.com", "Peter Pan"),
           new MsgKit.Representing("tinkerbell@neverland.com", "Tinkerbell"),
           "Hello Neverland subject"))
{
    task.Recipients.AddTo("captainhook@neverland.com", "Captain Hook");
    task.Recipients.AddCc("crocodile@neverland.com", "The evil ticking crocodile");
    task.Subject = "This is the subject";
    task.Status = MsgKit.Enums.TaskStatus.NotStarted;
    task.Complete = false;
    task.PercentageComplete = 0.0;
    task.DueDate = DateTime.Now.Date.AddDays(1).Date;
    task.StartDate = DateTime.Now.Date;
    task.Mode = MsgKit.Enums.TaskMode.Accepted;
    task.Recurring = false;
    task.ReminderTime = DateTime.Now.Date;
    task.BodyRtf = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}" +
                          @"This line is the default color\line\cf2This line is red\line\cf1" +
                          @"This line is the default color}";
    task.BodyRtfCompressed = true;
    task.BodyText = "Hello Neverland text";
    task.BodyHtml = "<html><head></head><body><b>Hello Neverland html</b></body></html>";
    task.SentOn = DateTime.UtcNow;
    task.Importance = MsgKit.Enums.MessageImportance.IMPORTANCE_NORMAL;
    task.IconIndex = MsgKit.Enums.MessageIconIndex.UnsentMail;
    task.Attachments.Add("Images\\peterpan.jpg");
    task.Attachments.Add("Images\\tinkerbell.jpg", -1, true, "tinkerbell.jpg");
    task.Save(@"d:\Task.msg");

    // Show the appointment
    System.Diagnostics.Process.Start(@"d:\Task.msg");
}

Core Team

Sicos1977 (Kees van Spelde)
Seeker25 (Travis Semple) - Implemented Appointment support

Support

If you like my work then please consider a donation as a thank you by using the sponsor button on the top

Reporting Bugs

Have a bug or a feature request? Please open a new issue.

Before opening a new issue, please search for existing issues to avoid submitting duplicates.

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. 
.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 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MsgKit:

Package Downloads
ExchangeActivities

This library includes some of Exchange Mail activities; * Get Exchange Mails * Get Exchange Mails By Category * Get Exchange Mails By Starting Date * Get Exchange Mail Categories * Add Exchange Mail Category * Change Exchange Mail Category * Save Mail As Eml File * Save Mail As Msg File * Save Mail As Msg File Without Attachments * Save All Attachments

DigitalZenWorks.Email.ToolKit

This client library provides functionality to help migrate email messages from dbx (Outlook Express) or eml format to Outlook. It also contains functionality to help clean up Outlook stores. Additional notes - https://github.com/jamesjohnmcguire/DigitalZenWorks.Email.ToolKit

Encryptomatic.MailDex.Lib

A .NET standard library for reading pst / ost files. Simple reader interface. Can read messages, contacts, tasks and appointments including recurrence pattern.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.8.1 11,599 6/22/2024
2.8.0 30,482 3/14/2024

- Updated nuget packages
- Added support directly for .net 4.6.2 so that you don't need .net standard 2.0 if you don't want to