Skip to content
A .NET library to make MSG files without the need for Outlook
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

What is MsgKit?

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

History

  • Started in 2015
  • Picked up again in August 2016, adding all the know MAPI (Named) properties
  • Finished adding all the named properties
  • Appointment support added by Travis Semple in 2017

License Information

MsgKit is Copyright (C) 2015-2019 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

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");
}

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.

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.

You can’t perform that action at this time.