0

I have problem when get Subject of mail. Problem is: if subject is English it is can get good but if subject is vietnamese (my language) it return null;

dkarp
  • 14,483
  • 6
  • 58
  • 65
giaosudau
  • 2,211
  • 6
  • 33
  • 64

2 Answers2

1
string encoding = msg.HtmlBody.ContentType.Split('=')[1];

string decodedBody = Encoding.GetEncoding(encoding).GetString(Convert.FromBase64String(msg.HtmlBody.TextData));
string decodedSubject = Encoding.GetEncoding(encoding).GetString(Convert.FromBase64String(msg.Subject.Split('?')[3]));
Trufa
  • 39,971
  • 43
  • 126
  • 190
martas
  • 19
  • 1
0

If you're using the old ImapX library, I invite you to upgrade to ImapX 2. It now supports automated decoding of subjects, file names and body content. The library is being constantly developed and supported. There is also sample code for all common operations.

Pavel Azanov
  • 188
  • 1
  • 11