Free Support Forum -

MailMessage.Save using HTML format saves with UTF-8 BOM header

Using the mail message here and the code below, the resulting HTML file is prepended with the UTF-8 BOM header. Is there a way to prevent Aspose.Email from prepending the BOM header to the output file (I tried with CheckBodyContentEncoding true and false, no difference)

                    MailMessage mailMessage = MailMessage.Load(from);
                    HtmlSaveOptions options = new HtmlSaveOptions
                        CheckBodyContentEncoding = true,
                        MailMessageSaveType = MailMessageSaveType.HtmlFormat,
                        ResourceRenderingMode = ResourceRenderingMode.EmbedIntoHtml
                    mailMessage.Save(toHtml, options);


Thank you for the issue description. You can prevent prepending the BOM header to output HTML file as below:

 mailMessage.BodyEncoding = new UTF8Encoding(false);

API Reference: MailMessage Properties