MimePartCharset Property |
Namespace: MailBee.Mime
For instance, if Content-Type header string is Content-Type: text/plain; charset="EUC-KR", this property will return EUC-KR value.
Note |
---|
Although MimePartTree object represents the root MIME part of the message and thus headers of that MimePart are the same as headers of the MailMessage itself, there still can be difference between msg.Charset and msg.MimePartRoot.Charset values. This is because msg.MimePartRoot.Charset always returns the charset information specified in the headers of this MIME part, while msg.Charset returns the charset specified in another MIME part in the case if the root part of the message does not contain the charset information but any of the nested parts does. This is common case for multi-part messages because multi-part parts do not contain charset information. Use MailMessage.Charset to determine the overall charset of the message. |
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // Show the charset specified in the message headers. Console.WriteLine(msg.MimePartTree.Charset);