Free Support Forum - aspose.com

Duplicate attachments after saving message

Scenario: Load EML file with winmail.dat, do not do any changes, save message back to file, open new EML file in Outlook. Aspose.Email 21.3.

Issue: There are 2 entries of each attachment.

Code sample:

var email = MailMessage.Load(@"sample.eml", new EmlLoadOptions           {
          PreserveTnefAttachments = false,
          PreserveEmbeddedMessageFormat = true,
      });

var saveOptions = SaveOptions.DefaultEml;
saveOptions.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
email.Save(@"processed.eml", saveOptions);

Sample EML file: sample.zip (25.1 KB)

For internal reference: MDP-11894.

Thanks.

@licenses,
Thank you for the issue description. I reproduced the error and recieved the same result. I’ve logged the issue in our tracking system with ID EMAILNET-40199. Our development team will investigate this case. You will be notified when it is fixed.

1 Like

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

The issue can still be replicated in a specific scenario.

See attached sample EML file: sample2.zip (65.0 KB)

var m= Aspose.Email.MailMessage.Load(@"sample2.eml", new EmlLoadOptions
{
    PreserveEmbeddedMessageFormat = true,
    PreserveTnefAttachments = false,
});

m.Save(@"sample2-resaved.eml", new EmlSaveOptions(MailMessageSaveType.EmlFormat)
{
    PreserveEmbeddedMessageFormat = false,
    FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments
});

The resulting EML file will contain inline images in the list of regular attachments.
Screenshot 2021-05-11 184933.png (211.9 KB)

@licenses,
Thank you for the issue description. I reproduced the problem and logged the issue in our tracking system with ID EMAILNET-40223. Our development team will investigate this case. You will be notified when it is fixed.