I have some code that reads MSG files. It works fine but we have a customer where it trips up with some of their files and throws an exception (see the attached screenshot).FZI2ssv8bJ.png (42.4 KB)
I’m not at liberty to share any of the customer’s emails unfortunately.
If you can’t view the image, here is the code fragment; it fails when calling MailMessage.Load()
// Now get the sent date of the MSG
MailMessage thisMSG;
thisMSG = MailMessage.Load(sFullPath);
Can you send us a file of such a message?
It may not contain a confidential data.
All we need is UTF-7 encoding and a reproducible exception.
We can make this topic private, if necessary.
Hi Dmitry, I got a colleague to build and test the same code on his machine and it appears to work as expected. We have more testing to do but the current indications are that the exceptions only occur when debugging on my machine.
I’ve tried the #pragma and project settings too, but your ExtractMessage is still throwing the “Support for UTF-7 is disabled. See SYSLIB0001 warning - .NET | Microsoft Learn for more information.” exception at runtime.
We have fixed this problem in recent versions, by forcing the use of UTF-8.
Unfortunately, older versions remain with this problem as Microsoft has deprecated this encoding.