Electronic signature is lost when converting MSG --> EML

I am trying to convert message in MSG format to EML. Original MSG is in draft format fist but that should not be an issue as MSG without draft flag is correctly signed (I can open it in Outlook and shows as signed with valid signature) before converting it to EML.


Converted EML is invalid (contains binary code at the beginning and end of the file). Expected text only. If opened in Outlook it shows MIME attachment instead of signed email and has some missing properties (e.g. from field, to field). Probably because of broken EML file.

Please find attached source code with sample MSG file.

Thank you,
Bostjan

Hi Bostjan,

Thank you for writing to Aspose support team.
Could you please give a try to the following sample code where PreserveSignedContent flag is used during conversion from MSG to EML and let us know the feedback?

var originalSignedDraftMsg = @"ConsoleApplicationAsposeMailOutlook.OutlookMessage.signed.msg";
MailMessage mailMessage;

using (var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(originalSignedDraftMsg))
{
    mailMessage = MailMessage.Load(resourceStream); //Load signed msg draft
    var mapiMessage = MapiMessage.FromStream(resourceStream);
    mapiMessage.SetMessageFlags(mapiMessage.Flags & ~MapiMessageFlags.MSGFLAG_UNSENT); //Set it as sent
    mapiMessage.Save(Path + @"\SentSignedMsg.msg");
    
    //Convert signed msg -> signed eml file
    MailMessage mailMessage22 = MailMessage.Load(Path + @"\SentSignedMsg.msg");
    
    EmlSaveOptions options = new EmlSaveOptions(MailMessageSaveType.EmlFormat);
    options.PreserveSignedContent = true;
    mailMessage22.Save(Path + "Resaved 2.eml", Aspose.Email.Mail.SaveOptions.DefaultEml);
}

Dear Muhammad,


Using your additions to code the message is successfully converted to EML (without unexpected binary content). Signature is preserved but essential information about the message is lost (from, to, subject).

Please find attached EML output sample. It seems like complete message header is missing.

Best regards,
Bostjan

Hi Bostjan,

Thank you for sharing your feedback.

We were able to reproduce the issue at our end using the latest version of the API and have logged it as EMAILNET-35129 in our issue tracking system. Our product team will investigate the problem further at their end and we’ll update you here once there is some information available in this regard.

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


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