Search code examples
c#.netoutlookoutlook-redemption

RDOMail. Property HTMLBody incorrectly decodes message


I have the following body of message in quoted-printable:

=D0=9E=D1=82=D0=B2=D0=B5=D1=82 1 =D0=BD=D0=B0 test 05<br> ------------- <br=
><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii=
"><meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">=
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--><div class=3D"WordSection1"><p class=3D"M=
soNormal"><span lang=3D"EN-US">Test 04<o:p></o:p></span></p></div>

The code above is decoded correctly by OpenPop. But when I set this string to HTMLBody it becomes incorrect(I see the following: Nrber 1 m` test 05 ------------- Test 04 )

rdoMessage.HTMLBody = decodedBody;

Also I have observed that it is shown correctly if I do the following:

rdoMessage.Body = decodedBody;
rdoMessage.HTMLBody = decodedBody;

What can cause this behaviour? How these two properties influence to each other?


Solution

  • What version of Redemption are you using? You need to specify the code page in the HTML header. You also need to make sure it is correctly converted to the UTF-16 encoding (that is what COM uses). It is also a good idea to HTML-encode all non-ASCII characters in the HTML string.