GemBox.Email is a .NET component that enables you to read, write, receive, and send emails from your .NET applications using one simple API.

Convert Email Files between MSG, EML and MHT in C# and VB.NET

GemBox.Email library supports loading and saving email messages from / to the following file formats:

  • MSG (Outlook Item)
  • EML (Electronic Mail Format)
  • MHT or MHTML (MIME HTML)

The following example demonstrates how to load an email message from one file format and save it to another file format.

Screenshot
Convert Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download a sample file

using GemBox.Email;
using GemBox.Email.Imap;
using GemBox.Email.Mime;
using GemBox.Email.Pop;
using GemBox.Email.Smtp;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // Load message
        MailMessage message = MailMessage.Load("Attachment.eml");

        // In order to achieve the conversion of a loaded email message 
        // to some other file format, we just need to 
        // save a MailMessage object to desired output file format.
        message.Save("Convert.msg");
    }
}
Imports System.Globalization
Imports System.Text
Imports GemBox.Email
Imports GemBox.Email.Imap
Imports GemBox.Email.Mime
Imports GemBox.Email.Pop
Imports GemBox.Email.Smtp

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' Load message
        Dim message as MailMessage = MailMessage.Load("Attachment.eml")

        ' In order to achieve the conversion of a loaded email message
        ' to some other file format, we just need to 
        ' save a MailMessage object to desired output file format.
        message.Save("Convert.msg")

    End Sub

End Module

Check next sample.