All Projects → Sicos1977 → Msgreader

Sicos1977 / Msgreader

Licence: mit
C# Outlook MSG file reader without the need for Outlook

Projects that are alternatives of or similar to Msgreader

Ost2pst
OST2PST - converts Outlook OST files to PST format
Stars: ✭ 46 (-83.92%)
Mutual labels:  email, outlook
Mfcmapi
MFCMAPI
Stars: ✭ 501 (+75.17%)
Mutual labels:  email, outlook
Email To Pdf Converter
Converts email files (eml, msg) to pdf
Stars: ✭ 110 (-61.54%)
Mutual labels:  email, outlook
Python O365
A simple python library to interact with Microsoft Graph and Office 365 API
Stars: ✭ 742 (+159.44%)
Mutual labels:  email, outlook
Msgkit
A .NET library to make MSG files without the need for Outlook
Stars: ✭ 74 (-74.13%)
Mutual labels:  email, outlook
Waveboxapp
Wavebox Classic has been updated to Wavebox 10. Learn more Wavebox.io
Stars: ✭ 1,198 (+318.88%)
Mutual labels:  email, outlook
gnome-email-notifications
Gnome Email Notifications
Stars: ✭ 65 (-77.27%)
Mutual labels:  email, outlook
traq
Super simple email open/click tracking server.
Stars: ✭ 62 (-78.32%)
Mutual labels:  email
Mjml React
React component library to generate the HTML emails on the fly
Stars: ✭ 257 (-10.14%)
Mutual labels:  email
docker-mbsync
A Docker container which runs the mbsync tool automatically to synchronize your email
Stars: ✭ 60 (-79.02%)
Mutual labels:  email
ioBroker.email
Send emails from ioBroker
Stars: ✭ 15 (-94.76%)
Mutual labels:  email
deltabot
Delta.Chat bot written in Python
Stars: ✭ 26 (-90.91%)
Mutual labels:  email
Mercure
Mercure is a tool for security managers who want to train their colleague to phishing.
Stars: ✭ 262 (-8.39%)
Mutual labels:  email
website-change-monitor
Monitor a website and get email and Slack notifications when specific changes are detected
Stars: ✭ 104 (-63.64%)
Mutual labels:  email
Workbase Server
Slack alternative, email integrated, build with Meteor
Stars: ✭ 284 (-0.7%)
Mutual labels:  email
amazon-workmail-lambda-templates
Serverless applications for Amazon WorkMail.
Stars: ✭ 17 (-94.06%)
Mutual labels:  email
Awesome Falsehood
😱 Falsehoods Programmers Believe in
Stars: ✭ 16,614 (+5709.09%)
Mutual labels:  email
Magento2 Gmail Smtp App
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers
Stars: ✭ 281 (-1.75%)
Mutual labels:  email
Laravel Email Campaigns
Send email campaigns using Laravel
Stars: ✭ 257 (-10.14%)
Mutual labels:  email
Notqmail
Collaborative open-source successor to qmail
Stars: ✭ 255 (-10.84%)
Mutual labels:  email

What is MSGReader

MSGReader is a C# .NET 4.5 and Standard 2.0 (supports C# .NET 4.6.1 and up) library to read Outlook MSG and EML (Mime 1.0) files. Almost all common object in Outlook are supported:

  • E-mail
  • Appointment
  • Task
  • Contact card
  • Sticky note

It supports all body types there are in MSG files, this includes:

  • Text
  • HTML
  • HTML embedded into RTF
  • RTF

MSGReader has only a few options to manipulate an MSG file. The only option you have is that you can remove attachments and then save the file to a new one.

If you realy want to write MSG files then see my MsgKit project on GitHub (https://github.com/Sicos1977/MsgKit)

Read properties from an Outlook (msg) message

using (var msg = new MsgReader.Outlook.Storage.Message("d:\\testfile.msg"))
{
        var from = msg.Sender;
        var sentOn = msg.SentOn;
        var recipientsTo = msg.GetEmailRecipients(MsgReader.Outlook.RecipientType.To, false, false);
        var recipientsCc = msg.GetEmailRecipients(MsgReader.Outlook.RecipientType.Cc, false, false);
        var subject = msg.Subject;
        var htmlBody = msg.BodyHtml;
        // etc...
}

Read properties from an Outlook (eml) message

var fileInfo = new FileInfo("d:\\testfile.eml");
var eml = MsgReader.Mime.Message.Load(fileInfo);

if (eml.Headers != null)
{
        if (eml.Headers.To != null)
        {
            foreach (var recipient in eml.Headers.To)
            {
                var to = recipient.Address;            
            }
        }
}

var subject = eml.Headers.Subject;

if (eml.TextBody != null)
{
        var textBody = System.Text.Encoding.UTF8.GetString(eml.TextBody.Body);
}

if (eml.HtmlBody != null)
{
        var htmlBody = System.Text.Encoding.UTF8.GetString(eml.HtmlBody.Body);
}

// etc...

Delete attachment from an Outlook message

This example deletes the first attachment

var outlook = new Storage.Message(fileName, FileAccess.ReadWrite);
outlook.DeleteAttachment(outlook.Attachments[0]);
outlook.Save("d:\\deleted.msg");

Translations

  • Kees van Spelde

    • English (US)
    • Dutch
  • Ronald Kohl

    • German
  • Yan Grenier (@ygrenier on GitHub)

    • French
  • xupefei

    • Simpl Chinese

Installing via NuGet

The easiest way to install MSGReader is via NuGet.

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

Install-Package MSGReader

Side note

This project can also be used from a COM based language like VB script or VB6. To use it first compile the code and register the com visible assembly with the command:

Regasm.exe /codebase MsgReader.dll

After that you can call it like this:

dim msgreader

set msgreader = createobject("MsgReader.Reader")
msgreader.ExtractToFolderFromCom "the msg file to read", "the folder where to place the extracted files"

License Information

MsgReader is Copyright (C) 2013-2021 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.

Core Team

Sicos1977 (Kees van Spelde)

Support

If you like my work then please consider a donation as a thank you.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].