TextBodyPartCharset Property
Gets or sets the charset of the text part contents.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public string Charset { get; set; }

Property Value

Type: String

Property Value

Type: String
A string containing the name of the charset of the text body part contents, or an empty string if the charset is not specified in the message.

When composing a message, you can use this property to set different charsets for different text parts of the message.

It has no effect on parsing messages. To set the encoding to be used during parsing messages, use EncodingDefault or EncodingOverride properties.

This sample creates a new message with HTML and plain-text bodies, sets different charsets for these bodies, and save the message to disk.
// 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).
MailMessage msg = new MailMessage();
msg.BodyHtmlText = "<b>Hello</b>, <i>World</i>!";
msg.BodyParts.Html.Charset = "utf-8";
msg.BodyPlainText = "Hello, World!";
msg.BodyParts.Plain.Charset = "us-ascii";
See Also