andrew slaughter
andrew slaughter

Reputation: 1127

c# MailMessage different country language

Im trying to set the mail message body of an html email to a different language im using

   MailMessage msg = new MailMessage();
   msg.BodyEncoding = Encoder ?????

thanks

Upvotes: 2

Views: 1290

Answers (2)

Bassam Alugili
Bassam Alugili

Reputation: 17043

Look to this info: http://en.wikipedia.org/wiki/UTF-8

As @SriramSakthivel mention in his comment you can do it:

UTF-8 Encoding support all language what you need!

MailMessage message = new MailMessage()
{
  From = new MailAddress("[email protected]", "Test"),
  BodyEncoding = Encoding.UTF8,
  Body = body,
  IsBodyHtml = true,
  ReplyTo = new MailAddress("[email protected]"),
  SubjectEncoding = Encoding.UTF8
}

Upvotes: 1

nvoigt
nvoigt

Reputation: 77364

The encoding is not about language, but about character set. C# uses UTF16 internally, so if you set your encoding to UTF, you should be able to write any text you want as UTF can express any character of any set. That's what UNICODE is used for.

Upvotes: 0

Related Questions