• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Convert MSG to EML

Converts an Outlook MSG file to an EML (MIME) file.

Code

using System.IO;
using DRIT.Mail;
using DRIT.Mail.Conversion;

// Load the MSG message
IMailMessage mail = MailFile.Load("message.msg");

// Save as EML using the IMailMessage.Save method
mail.Save("message.eml", MailMessageFormat.Eml);

// Alternatively, use MailMessageConverter directly for stream-based conversion
using (var input = File.OpenRead("message.msg"))
using (var output = File.Create("message.eml"))
{
    // Convert the loaded MAPI message to an EML stream
    var mapi = mail.MapiMessage;
    MailMessageConverter.MapiMessageToEml(mapi, output);
}

Remarks

MailMessageConverter provides static helpers for converting between the formats supported by the library. The IMailMessage.Save method is the simplest entry point for format conversion.

  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX