VintaSoft Imaging .NET SDK 15.2: Documentation for .NET developer
In This Topic
Codecs: How to convert an Email file to a HTML file?
In This Topic
Here is C#/VB.NET code that shows how to convert an Email file to a HTML file:
/// <summary>
/// Converts Email (.msg, .eml) document to a HTML document.
/// </summary>
/// <param name="emailFilePath">Path to a source Email file.</param>
/// <param name="htmlFilePath">Path to a result HTML file.</param>
public static void ConvertEmailToHtml(string emailFilePath, string htmlFilePath)
{
    // directory to save attachments
    string attachmentsDirectoryName = System.IO.Path.GetFileNameWithoutExtension(htmlFilePath) + ".files";

    // convert Email document to a HTML document
    Vintasoft.Imaging.Email.EmailDocumentConverter.ConvertEmailToHtml(
        emailFilePath, htmlFilePath, attachmentsDirectoryName, new Vintasoft.Imaging.Email.EmailToHtmlConverterSettings());
}
''' <summary>
''' Converts Email (.msg, .eml) document to a HTML document.
''' </summary>
''' <param name="emailFilePath">Path to a source Email file.</param>
''' <param name="htmlFilePath">Path to a result HTML file.</param>
Public Shared Sub ConvertEmailToHtml(emailFilePath As String, htmlFilePath As String)
    ' directory to save attachments
    Dim attachmentsDirectoryName As String = System.IO.Path.GetFileNameWithoutExtension(htmlFilePath) & ".files"

    ' convert Email document to a HTML document
    Vintasoft.Imaging.Email.EmailDocumentConverter.ConvertEmailToHtml(emailFilePath, htmlFilePath, attachmentsDirectoryName, New Vintasoft.Imaging.Email.EmailToHtmlConverterSettings())
End Sub