[Edit]
The latest version of Mail.dll fully supports Clear-Signed, Opaque-Signed and Encrypted S/MIME msg messages.
string fileName = @"Digitally signed_RE mail d.o.o..msg");
using (MsgConverter converter = new MsgConverter(fileName))
{
Msg2IMailConfiguration configuration = new Msg2IMailConfiguration
{
SMIMEConfiguration = {ExtractSignedAutomatically = false}
};
IMail email = converter.CreateMessage(configuration);
Assert.AreEqual("RE: mail d.o.o.", email.Subject);
Assert.AreEqual(null, email.HtmlData);
Assert.AreEqual(null, email.TextData);
Assert.AreEqual(true, email.IsSigned);
Assert.AreEqual(true, email.NeedsSignedExtraction);
IMail extracted = email.ExtractSigned();
Assert.AreEqual(null, extracted.Subject);
StringAssert.StartsWith("Uf. Možno.", extracted.Text);
StringAssert.StartsWith("<html xmlns:", extracted.Html);
extracted.CheckSignature(true);
}
At this point this is an expected behavior.
The problem is that msg file format destroys MIME structure completely. Parts that should be treated as document root are converted to .msg-file's attachments. Thus it is nearly impossible to rebuild the correct MIME structure.
Here's the code that shows how you can process this particular file:
string fileName = "Digitally signed_RE mail d.o.o..msg";
using (MsgConverter converter = new MsgConverter(fileName))
{
IMail email = converter.CreateMessage();
Assert.AreEqual("RE: mail d.o.o.", email.Subject);
MimePkcs7Mime pkcs7Mime = (MimePkcs7Mime)email.Attachments
.Find(x => x is MimePkcs7Mime);
email = new MailFactory().CreateMail(pkcs7Mime);
Assert.AreEqual(true, email.IsSigned);
Assert.AreEqual(true, email.NeedsSignedExtraction);
IMail extracted = email.ExtractSigned();
StringAssert.StartsWith("Uf. Možno.", extracted.Text);
StringAssert.StartsWith("<html xmlns:", extracted.Html);
extracted.CheckSignature(true);
}
We'll try to improve Mail.dll to handle such files better.