SmtpCharset Property |
Namespace: MailBee.SmtpMail
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 |
---|
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. |
// 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 = "Тело сообщения";