Convert .eml to .msg files using IndependentSoft C#
EML file extension is created by Microsoft Corporations for Email files. It is also known as RFC 822. In these files, email messages are stored in plain text formats. Microsoft’s Outlook Express uses this file extension to save Mail Messages.
Structure
- Headers – Contains information about message header (Email address of the sender and the receiver, time and date, subject)
- Message Body – Contains message content, attachments, and embedded images
Basic differences between EML file and MSG file:
EML | MSG |
---|---|
The file format is a plaintext MIME (rfc822) file format for storing emails. | It is a compound file binary format based on Microsoft’s Outlook MAPI. |
EML extension is supported by multiple email clients like Thunderbird, Outlook Express, and Windows Live Mail. | MSG extension is supported by Microsoft Outlook. |
This file can be generated by open-source e-mail clients such as Windows Mail and Thunderbird | This file can be generated by exporting an email from Outlook to file |
These files can be read by its E-mail clients along with others like Outlook. It can be opened in a text editor. | These files can only be saved for emails and messages. So, it can only be opened by MAPI based applications. |
To convert an EML file into an MSG file we are using the Independentsoft library. You can follow the below program to make the conversion:
using System;
using Independentsoft.Msg;
namespace Example
{
class Program
{
static void Main(string[] args)
{
Independentsoft.Email.Mime.Message mimeMsg = new
Independentsoft.Email.Mime.Message("
Independentsoft.Msg.Message msg = new Independentsoft.Msg.Message(mimeMsg );
msg.Save("
}
}
}
The converted MSG file will be stored at the destination location specified.