How to export Eml to Html (C# . NET)

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions
{
HtmlFormatOptions = HtmlFormatOptions.WriteHeader | HtmlFormatOptions.WriteCompleteEmailAddress
};

                                if (File.Exists(htmlPath + fileName + ".html"))
                                {
                                    int i = 1;
                                    while (File.Exists(htmlPath + fileName + "(" + i.ToString() + ")" + ".html"))
                                    {
                                        i++;
                                    }
                                    mailMessage.Save(htmlPath + fileName + "(" + i.ToString() + ")" + ".html", htmlSaveOptions);
                                    fileName = fileName + "(" + i.ToString() + ")";
                                }
                                else
                                {
                                    mailMessage.Save(htmlPath + fileName + ".html", htmlSaveOptions);
                                }

I use this code to convert eml to html. But Some emails are not saved with enail headers.
How can i solve this issue??

@alibardisk

I have observed the sample code shared and suggest you to please visit this documentation section to serve the purpose on your end. If you still find issue then please share the source file, generated output and desired output file. We will investigate the issue further on our end to help you.