0

I'm using ActionMailer.net to send email.

No matter what I do I can not get the subject in utf-8, it displays just question marks. Body shows in utf-8.

This is my last attempt to solve the issue:

public EmailResult AccountConfirmationEmail(AccountConfirmationModel acm)
{
    MailAttributes.MessageEncoding = Encoding.UTF8;
    MailAttributes.To.Add(new MailAddress(acm.BizUserId));
    MailAttributes.From = new MailAddress("service@abc.co.il");

    UTF8Encoding utf8 = new UTF8Encoding();
    string unicodeString = "אישור הרשמה לאתר";
    byte[] encodedBytes = utf8.GetBytes(unicodeString);

    MailAttributes.Subject = Encoding.UTF8.GetString(encodedBytes, 0, encodedBytes.Length);
    return Email("Account/AccountConfirmationEmail", acm);
}

to no avail.

Does anyone know how to do this?

HelloWorld
  • 2,392
  • 3
  • 31
  • 68
dsb
  • 2,347
  • 5
  • 26
  • 43
  • 2
    Searching `utf-8 email subject` i found [this](http://ncona.com/2011/06/using-utf-8-characters-on-an-e-mail-subject/) and [this related SO question](http://stackoverflow.com/questions/17064510/utf-8-encoding-for-subject-in-contact-form-email). – Kenney Sep 20 '15 at 11:29
  • @Kenney, thanks. I have found them as well and tried their suggestions several times, each time trying to manipulate other things. Nothing seems to work. Really frustrating. – dsb Sep 20 '15 at 11:51

0 Answers0