Click here to Skip to main content
15,117,830 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have code that send message to purpose email. When i run program from Windows - charset work correctly. But when i run this app in Linux VDS (Centos) charset incorrect - example ����������� ���. Message on cyrillic. I try make charset utf-8, but it also not work

SmtpClient smtp = new SmtpClient(Smtp, Convert.ToInt32(port));
smtp.Credentials = new NetworkCredential(login, pass);
smtp.EnableSsl = true;
MailMessage message = new MailMessage();
message.From = new MailAddress(from);
message.To.Add(new MailAddress(to));
message.IsBodyHtml = true;
message.Subject = subject;
message.Body = string.Format(msg);
message.BodyEncoding = Encoding.UTF8;
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900