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

Free Support Forum - aspose.com

PreserveTnefAttachments does not work properly


When I read TNEF message (EML with “winmail.dat”) and save it with PreserveTnefAttachments flag, then saved version is corrupted - Outlook shows rubbish when you try to open attached EML file (NOT main message, but EML file attached to it).(see 3.png).

If I save message with Save(path, MailMessageSaveType) - Outlook shows correct content.

Used Aspose.Email.dll - 4.2.0.

Sample project is attached.

Best regards,
Alex Shloma
Here is other issues I faced with while testing PreserveTnefAttachments. They may be relate to the same bug.

  • I tried to change attachment name:

main.Attachments[0].Name = main.Attachments[0].ContentDisposition.FileName = "ddd.txt";
And attachment name in the saved version was not changed with PreserveTnefAttachments flag.

  • I tried another message with DOCX attachment. DOCX is also gets corrupted after saving message with PreserveTnefAttachments. Word cannot open it. Following message is shown by MS Office Word: "We're sorry. We can't open NAME because we found a problem with its content".

Attached test message: messageWithDocx.eml.

  • InvalidOperationException exception is thrown with text "This is not a structured storage file." if original message was in "Rich Text" (see Outlook Ribbon > Format text > Format > "Rich Text").

Attached test message: RTF_body.eml.

Hi Alex Shloma,

Thank you for contacting Aspose support team again.

I have analyzed your requirements and observed that MailMessageLoadOptions is not used in the code. Please use following sample code to load the sample EMLs like “message.eml”, “RTF_body.eml” and “messageWithDocx.eml”.

new Aspose.Email.License().SetLicense(@"");
MailMessageLoadOptions loadOptions = new MailMessageLoadOptions();
loadOptions.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
loadOptions.MessageFormat = MessageFormat.Eml;
var main = MailMessage.Load(@“RTF_body.eml”, loadOptions);
main.Save(@“RTF_body_saved_PreserveTnefAttachments.eml”, FileCompatibilityMode.PreserveTnefAttachments);
main.Save(@“RTF_body_saved_EmlFormat.eml”, MailMessageSaveType.EmlFormat);

It will address all your concerns in the above two threads accept changing the attachment name. Could you please try removing the attachment before changing the attachment name and then add it again with new attachment name?

Please feel free to write us back if you have any other query in this regard.


If I use MailMessageLoadOptions.FileCompatibilityMode, then I lose ability to work with actual attachments (for example, 2 DOCX files in one message). When this option is used, then Attachments collection contains only one object, which represents “winmail.dat” (this is the only MIME part which is of “application/ms-tnef” type) and contains entire message information: all attachments and other).

In your code attachment was not renamed with MailMessageLoadOptions used, because the name of MIME part was changed:
Content-Type: application/ms-tnef; name="1.docx"
but not the name of actual attachment.

I attached sample .EML message in Tnef with 2 Word documents.

Best regards,
Alex Shloma
Hi Alex,

Thank you for sharing your concern with us.

I was able to reproduce all the issues at my end using the latest version of Aspose.Email for .NET 4.2.0 and have logged them as NETWORKNET-34395, NETWORKNET-34396 and NETWORKNET-34397 respectively in our issue tracking system for further investigation by our development team. Once there is any information available in this regard, we'll update you here via this thread here.

Regarding changing the name of attachment, we are working on this issue and will write back here soon.

We are sorry for the inconvenience caused to you.

Hi, Kashif Iqbal.

Nice to here it. Looking forward to resolution.

Kashif Iqbal, can you please answer one question. If I demand moving this ticket to priority support forum, does it mean that my ticket quota will be decreased by the number of logged issues (currently 3 in this ticket) or by 1?

Alex Shloma

Hi Alex,

This thread contains 3 tickets (logged issues) with normal priority. If a single ticket needs to be moved to Priority support, it will be moved Priority Support forum and will consume 1 slot from your quota i.e. your quota will be decreased by 1 for 1 ticket moved to Priority Support.

Hi Kashif Iqbal.

Can you please provide me with information regarding current status of the following bug: attachments become corrupted if PreserveTnefAttachments flag is used while saving message:
  • is there any movement on this;
  • approximate time to get it fixed.
Please contact developers if needed.

It is really critical bug for me.

Alex Shloma

Hi Alex,

Yes, the issue is under investigation by development team at present and will be fixed soon. We are planning to provide the fix for this issue in the upcoming version of Aspose.Email for .NET 4.3.0 which is due by the end of this week. Once it is available, we’ll update you here via this thread.

The issues you have found earlier (filed as NETWORKNET-34395;NETWORKNET-34396;NETWORKNET-34397) have been fixed in this update.

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

Tested Aspose.Email Works perfectly - no issues replicated.

Good job guys.

Alex Shloma

Hi Alex,

Thank you for providing feedback. Please feel free to write to us in case you have any additional query/inquiry related to Aspose.Email.