We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MailMessage conversion / save to EML format: BOM is present in HTML part of message


The UTF-8 byte order mark (=EF=BB=BF) is appended to the HTML part when converting / saving a mail message to EML format (5.8.0). This was not the case when using version 5.3.0 of Aspose Email.

Is the observed behavior really the expected one? Is there a way to omit the BOM?

Code to reproduce:

String eml = “”
+ “MIME-Version: 1.0\n”
+ “Content-Type: text/html; charset=“utf-8”\n”
+ “Content-Transfer-Encoding: quoted-printable\n”
+ “\n”
+ “Hi\n”;

// same result when using new EmlLoadOptions() instead of MailMessageLoadOptions.getDefaultEml()
MailMessage mailMessage = MailMessage.load(new ByteArrayInputStream(eml.getBytes(StandardCharsets.UTF_8)), MailMessageLoadOptions.getDefaultEml());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
mailMessage.save(bos, SaveOptions.getDefaultEml());
System.out.println(new String(bos.toByteArray(), StandardCharsets.UTF_8));

// last line of output
// 5.8.0: =EF=BB=BFHi
// 5.3.0: Hi

Thanks in advance.

Kind regards

Hi Stephan,

Thank you for writing to Aspose support team.

I have tested the sample code using both Aspose.Email for Java 5.3.0 and 5.8.0. It is observed that BOM is appended to the Html part. This issue is logged under Id:EMAILJAVA-33550 in our issue tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

The issues you have found earlier (filed as EMAILJAVA-33550) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Great, thanks for the fix.

Hi Stephan,

Thank you for the feedback and please feel free to write us back if you have any other query related to Aspose.Email.

Hi Muhammad

I’ve tested the above code with Aspose Email 5.9.0, but this
results in the same (wrong) output as for 5.8.0 (i.e. includes the BOM). Do I need to set a flag (or something similar) or isn’t the bug fixed yet?

Kind regards

Hi Stephan,

We have reopened this ticket and have requested our product team to look into it again. We shall update you here as soon as some information is available about this issue. We are sorry for the trouble you are facing.


I am still facing this issue. I am using the aspose-email-17.2.0-jdk16.jar. Could you please update me the status of this issue: EMAILJAVA-33550.


I’ve tested it with 16.10.0 and there it seems to be correct. But I haven’t tried a never version.


We have tested this with the latest version of the API and weren’t able to reproduce any such issue as you have reported. Could you please make sure that you are using the latest version of the API at your end?