Convert EML/EMLX to MHTML or MSG in C#, VB.NET

Friday, 04 August 2017 09:07 Written by  support iceblue
Rate this item
(0 votes)

A file with the EMLX or EML file extension is a Mail Message file used to store an email message. EML/EMLX file can converted to MHTML or MSG file format with few lines of core code by using Spire.Email.

Convert EML/EMLX to MHTML

[C#]
using Spire.Email;
using System;

namespace ConvertEMLandEMLXtoMHTML 
{
    class Program
    {
        static void Main(string[] args)
        {
            MailMessage message = MailMessage.Load("example.eml");
            message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml);
            Console.WriteLine("Done");
        }
    }
}
[VB.NET]
Imports Spire.Email

Namespace ConvertEMLandEMLXtoMHTML
	Class Program
		Private Shared Sub Main(args As String())
			Dim message As MailMessage = MailMessage.Load("example.eml")
			message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml)
			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace

Convert EML/EMLX to MSG

[C#]
using Spire.Email;
using System;

namespace ConvertEMLandEMLXtoMSG 
{
    class Program
    {
        static void Main(string[] args)
        {
            MailMessage message = MailMessage.Load("example.eml");
            message.Save("ToMsg.msg", MailMessageFormat.Msg);
            Console.WriteLine("Done");
        }
    }
}
[VB.NET]
Imports Spire.Email

Namespace ConvertEMLandEMLXtoMSG
	Class Program
		Private Shared Sub Main(args As String())
			Dim message As MailMessage = MailMessage.Load("example.eml")
			message.Save("ToMsg.msg", MailMessageFormat.Msg)
			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace

Additional Info

  • tutorial_title:
Last modified on Wednesday, 15 September 2021 03:31