VintaSoft Imaging .NET SDK 15.2: Documentation for .NET developer
Vintasoft.Imaging.Email Namespace / EmailDocumentConverter Class / ConvertEmailToHtml Methods / ConvertEmailToHtml(String,String) Method
Syntax Example Requirements SeeAlso
In This Topic
ConvertEmailToHtml(String,String) Method (EmailDocumentConverter)
In This Topic
Converts Email (.eml, .msg) document to a HTML document with default converter settings.
Syntax
'Declaration

Public Overloads Shared Function ConvertEmailToHtml( _
ByVal emailFilename
The filename of input Email (.eml, .msg) document.
As System.String, _
ByVal htmlFilename
The filename of output HTML document.
As System.String _
) As System.String[]
public static System.String[] ConvertEmailToHtml(
System.String emailFilename,
System.String htmlFilename
)

Parameters

emailFilename
The filename of input Email (.eml, .msg) document.
htmlFilename
The filename of output HTML document.

Return Value

An array that contains name of HTML file and names of resource files.
Example

This C#/VB.NET code shows how to convert Email document to a HTML document.


''' <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


/// <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());
}

Requirements

Target Platforms: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also