Cyrillic theme encoding in C # letters

I am trying to send an email via C # and use the following code:

public static bool SendSMTPMail(string smtphost, int smtpport, string smtplogin, string smtppassword, string from, string to, string subject, string body, bool isHtml)
{
  try
  {               
    using (MailMessage message = new MailMessage(from, to, subject, body))
    {
      message.IsBodyHtml = isHtml;
      message.SubjectEncoding = System.Text.Encoding.UTF8;
      message.BodyEncoding = System.Text.Encoding.UTF8;

      SmtpClient mailClient = new SmtpClient(smtphost, smtpport);
      mailClient.EnableSsl = false;
      mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
      mailClient.Credentials = new NetworkCredential(smtplogin, smtppassword);

      mailClient.Send(message);
      return true;
    }
  }
  catch
  {
    return false;
  }
}

It works great when emails arrive on Windows, but when a user tries to read them in the MacOS theme header, this is the wrong encoding. If I set the encoding of the theme to Windows-1251, it works well, but only for Cyrillic objects, and I will also send Asian ...

How can I send emails using pure Unicode?

And the second question: if I add an attachment to the mail, it will be added with additional files - "filelist.xml" and "header.htm".

How to get rid of them?

Thaks!

+5
source share
2 answers

, ,

...

0

- , , :

  • generic utf8
  • iso xxx
  • iso xxy

..

+1

All Articles