Embedded images lost when using SaveAsTemplate

Hi,

I am opening an OFT file as follows:

mailMessageDocument = MailMessage.Load(mailStream)

where ‘mailStream’ is a MemoryStream containing the OFT file.

I then try to save the OFT file after making changes by creating a MapiMessage as follows:

var message = MapiMessage.FromMailMessage(_mailMessageDocument);
message.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
using (var outputStream = new MemoryStream())
{
    message.SaveAsTemplate(outputStream);
}

When writing the resulting outputStream to disk, the resulting OFT file opens, but any embedded images in the original are lost.

If I save the same OFT as MSG using outlook, and use MapiMessage.Save to save the MSG file, the embedded images are retained.

How can I preserve the images when saving as OFT?

I am using Aspose.Email version 18.3

Many thanks
Hamish

OFTContent.zip (294.0 KB)

@hamishm,

Thank you for writing to Aspose support team.

I have tested the scenario with latest library Aspose.Email for .NET 18.3.0 using following sample code, but could not observe any issue. Images are retained in the output oft file. Could you please give it a try using latest library and share the feedback? The output oft file is attached here for your reference.

MailMessage mail = MailMessage.Load(@"OFT SF Content (1).oft");
var message = MapiMessage.FromMailMessage(mail);
message.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
using (var outputStream = new MemoryStream())
{
    message.SaveAsTemplate(outputStream);
    var newmail = MailMessage.Load(outputStream);
    newmail.Save(@"output.oft", MsgSaveOptions.DefaultMsgUnicode);
}

output.zip (288.7 KB)