Вопрос

I have a requirement where an email is sent to an user and he can directly reply to the email and that email's content gets posted in his account.

Problem is accented characters are not showing up properly when user posts the content from his email. I send email using MailMessage class:

message.BodyEncoding = Encoding.UTF8;
message.SubjectEncoding = Encoding.UTF8;

As you can see both the body and subject are UTF8 encoded. But when I post the message from my email, the accent gets converted to ?. Can anybody tell me what am I missing?

Edit: Does this have anything to do with IsBodyHtml? I haven't set IsBodyHtml to true. Is that required?

Это было полезно?

Решение

I appears that despite using UTF8 for the encoding the default media type used for the body is text/plain--which is ASCII (i.e. the ASCII character set). If you use IsBodyHtml, it will use a media type of text/html which will use the ISO-8859-1 character set.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top