Issue in loading Msg with Tnef attachment

Hello,
When concerting msg to eml/mht , I always set xxxLoadOptions.PreserveTnefAttachments = False
I noticed that for some messages, there’s no difference if we set PreserveTnefAttachments to True or False
winmail.dat is always attached to the resulting eml and the target message body etc is not processed

Set PreserveTnefAttachments to True and False to see no difference in resulting eml
Sample project + sample msg to reproduce:
WindowsApplication1.zip (205.7 KB)

Now, set the DecodeSignedContent to True and try again, this time Tnef is extracted and body saved correctly

Is it possible to add Tnef processing support for IPM.Note.SMIME messages without setting DecodeSignedContent = True ?


Beside that, there’s a 2nd issue, in my sample project, if you set:
MsgLoadOptions.DecodeSignedContent = True

Then setting PreserveTnefAttachments to True or False will make the same result
I mean we cannot keep the Tnef attachment and it always be extracted.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILNET-40945

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @australian.dev.nerds
I think you were confused by the MsgLoadOptions.PreserveTnefAttachments setting, it is not intended for the MapiMessage and works when loading the msg file into the MailMessage. We will discuss this with the lead. Instead, to get the desired result, I suggest using EmlSaveOptions.FileCompatibilityMode, see the code below :

        string fileName = "msg.msg";
        MsgLoadOptions lopt = new MsgLoadOptions();
        lopt.DecodeSignedContent = true;
        MapiMessage message = MapiMessage.Load(fileName, lopt);
        EmlSaveOptions sopt = new EmlSaveOptions(MailMessageSaveType.EmlFormat);
        sopt.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
        message.Save(fileName + ".eml", sopt);

lopt.DecodeSignedContent = true;
sopt.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
the resulting eml is signed and contains tnef attachment

lopt.DecodeSignedContent = true;
sopt.FileCompatibilityMode = FileCompatibilityMode.None;
the resulting eml is signed and does not contain tnef attachment

lopt.DecodeSignedContent = false;
sopt.FileCompatibilityMode = FileCompatibilityMode.None;
the resulting eml is unsigned and does not contain tnef attachment

lopt.DecodeSignedContent = false;
sopt.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
the resulting eml is unsigned and contains tnef attachment