MailMessage.Load adding ?'s

Hi,

I am using MailMessage.Load() method to convert an .eml file to a Message. For some .eml files, the conversion is adding extra ?'s .

Has anyone ran into this and knows what could be causing this? Is there a workaround?

Below is a code snippet that I am using to repro the issue with the files that has this issue. Also note, I have tried with many different versions pf Aspose.Email, including the latest.

       var file = new FileInfo(filename);
       Console.WriteLine(file.Name);
       
       MailMessage mailMessage = MailMessage.Load(file.FullName);
       mailMessage.BodyEncoding = Encoding.UTF8;

       Console.WriteLine(mailMessage.Body);

Hello @samium ,

Thank you for sharing your issue.
Can you please share the sample file that causes the problem?

Thank you.

_Attune_Insurance__Re__A_Message_From_Attune_Insurance___Mother_Herb___and_OIls_LLC_C_4NH9_235898_CYBER_2022.eml
FW__414PK_77918_01___Bath_Benson_Bergen_LLC___Sicilian_Club_Holdings___LLC___Notice_of_Conditional_Renewal.eml
Hi,

I have the two files attached.

Thanks,
Sami

Thanks for the files you have provided.
We will investigate this case and reply to you as soon as possible.

Hello @samium ,

As a result of our investigation, we found out that this is not a problem with Aspose.Email, but a configuration of the console output.
The default console encoding is the same as in the operating system, so in some cases there can be problems.
You can force the console encoding by setting the Console.OutputEncoding property as follows:

var msg = MailMessage.Load("123.eml");
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine(msg.Body);