| Dart Home | PowerTCP Mail for .NET | Custom Development | Reply | PowerTCP Mail for .NET Topics | Forums |
| Author | Forum: PowerTCP Mail for .NET Topic: converting html entities |
| compufit From: Oostende, Belgium Posts: 3 Member Since: 05/06/10 |
posted May 21, 2010 8:56 AM Hey, i want to send an html mail. The mail can contain tables, summaries, special characters ex: & é " ' ( § è ! ç à ) - 1 2 3 4 5 6 7 8 9 0 ° _ + / . ; : = ~ µ £ € @ { } # \ When i receive the mail, its like this & ? " ' ( ? ? ! ? ? ) - 1 2 3 4 5 6 7 8 9 0 ? _ + / . ; : = ~ ? ? ? @ { } # \ I only get the text between <body>...</body> and then I want to convert the special characters in the found text with System.Web.HttpUtility.HtmlEncode(), but he also convert ex the <table>, </table>, <tr>, .... is there any method that allows me to convert only the & é " ' ( § è ! ç à ) - 1 2 3 4 5 6 7 8 9 0 ° _ + / . ; : = ~ µ £ € @ { } # \ //getting the text between <body>...</body> and convert the html entities int indexBeginBody = text.IndexOf("<body"); string tmp = text.Substring(indexBeginBody + 1); //getting all text after <bodyXXXXXXXXXXXXXXXX int indexBeginBodyEndTag = tmp.IndexOf(">"); //search the > tag of <body tmp = tmp.Substring(indexBeginBodyEndTag + 1);//getting all the text after <body ....>XXXXXXXXXXXX int indexEndBody = tmp.LastIndexOf("</body>"); tmp = tmp.Substring(0, indexEndBody); text = text.Replace(tmp,HttpUtility.HtmlEncode(tmp)); my html code: <?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http |
| Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted May 25, 2010 10:07 AM You probably need to add the encoding of the message to the email header(s). To do this, you may utilize the MessageStream.Header.Add method. For more information, you may examine the HeaderLabelType enumeration. |
| compufit From: Oostende, Belgium Posts: 3 Member Since: 05/06/10 |
posted May 26, 2010 8:08 AM Hey, I have tried serveral ways, but the html entities won't disply correctly. MessageStream msg = null; ... constructing messagestream.. at the end i have this line msg.Header.Add(HeaderLabelType.ContentType, "multipart/alternative"); u can read the mail, except for the entities another type.. msg.Header.Add(HeaderLabelType.ContentType, "text/html"); The mail is an attachment .... it must be normal mail... |
| Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted May 27, 2010 12:22 PM Have you tried setting 'Encoding:'? You will need to set it to the encoding value of your text. |
| Reply | PowerTCP Mail for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|