If we re-save the file in the EML format, it preserves the original subject, but if we save it in the MSG format, it corrupts the Subject by dropping the space(s).
I've attached a EML source file which will reproduce this behavior.
static void TestMessageLoadSave(string path)
{
using (var msg = MailMessage.Load(path, MessageFormat.Eml))
{
var pathNew = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + MakeValidFileName(msg.Subject + ".msg");
msg.Save(pathNew, MessageFormat.Msg);
}
}
static string MakeValidFileName(string name)
{
string invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars()));
string invalidReStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars);
return System.Text.RegularExpressions.Regex.Replace(name, invalidReStr, "_");
}