Encoding problem in the saved eml file after calling MapiMessage.FromMailMessage


We use Aspose.Email to load eml files, convert the MailMessage to MapiMessage for mail processing, and finally save it back to eml file.

Our code is like:

MailMessage emlmailmsg = MailMessage.Load(stream);
var mapimsg= MapiMessage.FromMailMessage(emlmailmsg, new MapiConversionOptions(OutlookMessageFormat.ASCII));
mapimsg.Save(@"C:\TestFiles\testoutput.eml", SaveOptions.DefaultEml);

When we open the saved testoutput.eml file in VS code, we found the Content-Transfer-Encoding is set to “quoted-printable”, which seems to make the dots “.” encoded as “=2E” in the mail body:


Content-Type: text/plain; charset="utf-8"

Content-Transfer-Encoding: quoted-printable

Sender: Mohan=2ESee@alpha=2Ecompany=2Ecom

Subject: Email 1: (Internal use only) with Protected attac=


Message-Id: <9d2276845106446b9f1c5ea79d2a0b0c@alpha=2Ecompany=2Ecom>

To: Varun=2EAgg@alpha=2Ecompany=2Ecom

Is there a way for us to change the value of Content-Transfer-Encoding so that the characters in the output mail body are not encoded?

The input eml file is like this and we hope the output can be the same:


Content-Type: text/plain; charset="us-ascii"

Content-Transfer-Encoding: 7bit

Sender: Mohan.See@alpha.company.com

Subject: Email 1: (Internal use only) with Protected attachment

Message-Id: <9d2276845106446b9f1c5ea79d2a0b0c@alpha.company.com>

To: Varun.Agg@alpha.company.com

Troubleshooting we have taken:

1, If we directly save as eml file before calling MapiMessage.FromMailMessage, it maintains the original Content-Transfer-Encoding value and text is not encoded. So it seems MapiMessage.FromMailMessage changes the Content-Transfer-Encoding to “quoted-printable”.

2, If we call mapimsg.ToMailMessage to convert it back to MailMessage and save, the result is the same.

Any help would be really appreciated!


I have observed the issue shared by you and request you to please try using latest Aspose.Email for .NET 20.1 on your end. In case the issue is still persisting then please share the source MSG file and EML output obtained that we will investigate further on our end to help you out.

Hi Mudassir,

Thanks for the quick reply. Yes I tried with latest release and the issue was still there.

Just to clarify, did you mean that you could reproduce the issue or not? I will check further to see if we could share the eml file, but I am guessing if you modify your eml file and replace the mail body with what I pasted before, and use the same code workflow, can you reproduce the issue?

The input is eml file and output is also eml file.

Please kindly see the eml attached:UPEPA.zip (102.1 KB)

I am glad to answer any question if you could not reproduce the issue.


Thank you for sharing the source file. I have worked over it using Aspose.Email for .NET 20.1 on my end and have observed encoding limitations mentioned by you. I have created an issue with ID EMAILNET-39740 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be addressed.

Thanks a lot!
As our release of the project might be impacted of this, just wondering normally how long it might need to get a fix if this is a product issue? If any ETA could be shared, that is much appreciated.


I like to share that the issue has just been added in our issue tracking system and we request for your patience in this regard. We will share the good news with you as soon as the issue will be fixed.

@mudassir.fayyaz I saw the EMAILNET-39740 is marked as resolved but I cannot view the details.
May I know if it means it is fixed in the product? Any details would be appreciated.


You may please try using TransferEncoding of your choice in such way:

            string fileName = "UPEPA.eml";
            MapiMessage mapi = MapiMessage.Load(fileName, new EmlLoadOptions());
            MailMessage msg = mapi.ToMailMessage(new MailConversionOptions());
            foreach (var item in msg.AlternateViews)
                item.TransferEncoding = TransferEncoding.SevenBit;
            msg.Save(fileName + ".eml");

Thanks a lot! We will try this and let you know and come back if we encounter problems.


Thank you for sharing the feedback.