Dart Home | PowerTCP Mail for .NET | Custom Development | Reply | PowerTCP Mail for .NET Topics | Forums |
Author | Forum: PowerTCP Mail for .NET Topic: How to create a multipart message with utf-8 charset |
dspkoester From: München, Germany Posts: 13 Member Since: 05/26/05 |
posted May 2, 2009 9:34 AM Hello, I want to create a smtp message with a html part. The html contains e.g. the Euro sign that requires the utf-8 charset. MessageStream msgHtml = new MessageStream(this.sHtmlDatei); msgHtml.Charset = System.Text.Encoding.UTF8.BodyName; ; msgHtml.ContentType = "text/html"; omsg.Parts.Complex.Add(msgHtml); This should create 2 parts, one text/plain and one text/html part. Both should have the utf-8 charset and a header that contains the charset. But this doesn't work. The text part has iso-8859-1 in it's header but is a utf-8. The html part is utf-8 too but the charset is missing in it's header. How can I get a correct header of the text part and the charset entry for the html part TIA Thomas This comes from PowerTCP: ------=_NextPart_6_847872236 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =E2=82=AC ------=_NextPart_6_847872236 Content-Type: text/html Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"> </head> <body> =E2=82=AC <br> <br> <br> </body> </html> ------=_NextPart_6_847872236-- The same Email from Outlook Express is following here: ------=_NextPart_000_1330_01C9CB38.C11FE5B0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =E2=82=AC ------=_NextPart_000_1330_01C9CB38.C11FE5B0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"> <META content=3D"MSHTML 6.00.6000.16825" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>=E2=82=AC</FONT></DIV></BODY></HTML> ------=_NextPart_000_1330_01C9CB38.C11FE5B0-- |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted May 4, 2009 11:55 AM Hi Thomas, You can set the parts' charsets after the MessageStream is constructed. For example: //Set charset of text parts in HTML message foreach (MessagePartStream part in msg.Parts.Complex[0].Parts.Complex[0].Parts) part.Charset = "utf-8"; Hope it helps, -ken ------ |
Reply | PowerTCP Mail for .NET Topics | Forums |
This site is powered by
![]() |