Table of Contents

Method EmlToMarkdown

Namespace
LMKit.Document.Conversion
Assembly
LM-Kit.NET.dll

EmlToMarkdown(byte[], bool, CancellationToken)

Converts an EML file (as a byte array) to Markdown.

public static string EmlToMarkdown(byte[] emlData, bool stripQuotes = false, CancellationToken cancellation = default)

Parameters

emlData byte[]

The EML file content as a byte array.

stripQuotes bool

When true, quoted and reply content is removed from the email body.

cancellation CancellationToken

A cancellation token used to cancel the conversion operation.

Returns

string

A Markdown string representing the email content.

Examples

using LMKit.Document.Conversion;

byte[] emlBytes = File.ReadAllBytes("invoice.eml");
string markdown = EmlMarkdownConverter.EmlToMarkdown(emlBytes);
Console.WriteLine(markdown);

Exceptions

ArgumentNullException

Thrown when emlData is null.

EmlToMarkdown(string, bool, CancellationToken)

Converts an EML file at the specified path to Markdown.

public static string EmlToMarkdown(string inputPath, bool stripQuotes = false, CancellationToken cancellation = default)

Parameters

inputPath string

The file system path to the EML file.

stripQuotes bool

When true, quoted and reply content is removed from the email body.

cancellation CancellationToken

A cancellation token used to cancel the conversion operation.

Returns

string

A Markdown string representing the email content.

Examples

using LMKit.Document.Conversion;

string markdown = EmlMarkdownConverter.EmlToMarkdown("message.eml");

Exceptions

ArgumentException

Thrown when inputPath is null or whitespace.

FileNotFoundException

Thrown when the specified file does not exist.