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

Free Support Forum - aspose.com

Embedded message does not get updated in EML message


Scenario: I have EML message in TNEF format (it contains winmail.dat MIME part) - “original.eml”. EML message contains embedded message. My code replaces existing embedded messages with the one from file (“cleaned-embedded.eml”) and saves main EML message back to file.

Issue: Re-saved EML message (“main.updated.eml”) still has old embedded message - see attachments of the embedded message.


var originalPath = @"main.original.eml";
var originalUpdatedPath = @"main.updated.eml";
var cleanedEmbeddedMessagePath = @"cleaned-embedded.eml";

using (var originalStream = File.OpenRead(originalPath))
using (var originalMessageCopy = MailMessage.Load(originalStream, new EmlLoadOptions
    PreserveEmbeddedMessageFormat = true,
    PreserveTnefAttachments = false,
using (var cleanedEmbeddedMessageStream = File.OpenRead(cleanedEmbeddedMessagePath))
    var att = originalMessageCopy.Attachments[0];
    att.ContentStream = cleanedEmbeddedMessageStream;
    att.Name = "cleaned embedded message";

    var saveOptions = SaveOptions.DefaultEml;
    saveOptions.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
    saveOptions.PreserveEmbeddedMessageFormat = true;

    originalMessageCopy.Save(originalUpdatedPath, saveOptions);

sample.zip (6.5 MB)


For internal reference: MDP-12534


I have created an issue with ID EMAILNET-40306 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.

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