How to Set Margin when Converting EML to HTML?

I want to convert eml to html with custom option like Margin ,add header footer .provide solution
Platform c#

@mukundmalpaniweb,
Thank you for posting the query. Unfortunately, I have not found a capability to set the margin when converting email messages to HTML. I logged the issue with ID EMAILNET-40409 in our tracking system. Our development team will consider such a feature. I will inform you of any progress.

To add headers to HTML, you can use HtmlFormatOptions.WriteHeader as shown below:

using (MailMessage mailMessage = MailMessage.Load("text.eml"))
{
    HtmlSaveOptions options = SaveOptions.DefaultHtml;
    options.HtmlFormatOptions = HtmlFormatOptions.WriteHeader | HtmlFormatOptions.WriteCompleteEmailAddress;

    mailMessage.Save("text_out.html", options);
}

Documents: Saving Message as HTML
API Reference: HtmlFormatOptions Enumeration

Could you clarify in more detail your requirements about footers, please?

@mukundmalpaniweb,
To set margin for HTML output, you can use HtmlSaveOptions.CssStyles property as shown below:

using (MailMessage message = MailMessage.Load(folderPath + "test.eml", new EmlLoadOptions()))
{
    HtmlSaveOptions saveOptions = new HtmlSaveOptions();
    saveOptions.HtmlFormatOptions = HtmlFormatOptions.WriteHeader; // headers must be included to HTML output

    int endStyleIndex = saveOptions.CssStyles.IndexOf("</style>");
    saveOptions.CssStyles = saveOptions.CssStyles.Insert(endStyleIndex, "body { margin: 30pt 40pt; } ");

    message.Save(folderPath + "test_out.html", saveOptions);
}

API Reference: HtmlSaveOptions Class