SmtpCharset Property
Gets or sets charset of the message.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.3.1 build 666 for .NET 4.5
public string Charset { get; set; }

Property Value

Type: String
The name of the character set the message is composed with. The default value is an empty string.

This property is equivalent to Charset property of Message object.

If no charset is specified in the message, mail reader program of the message recipient will use the default system charset to display the message.

Note Note
Some mail servers add charset setting to the message if it has no charset specified. This may cause the message to be displayed incorrectly. To avoid this, always specify Charset property if the message contains non-US characters.
Setting Windows-1251 charset for the message composed in Russian.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;
using MailBee.Mime;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();

// Indicate the message uses Cyrillic charset.
mailer.Charset = "windows-1251";

// "The message subject" in Russian (note that using MailMessage.GetEncodedHeaderValue 
// is not necessary, since charset is set for entire message in Charset property).
// MailMessage.GetEncodedHeaderValue is required when charset of the message 
// differs from charset of the header value.
mailer.Subject = "Тема сообщения";

// "The message body" in Russian.
mailer.BodyPlainText = "Тело сообщения";
See Also