How to send mail bodies with german umlauts using System.Net.Mail?

R

Roberto Rocco

Hello,

I'm using VS 2005 and I need to send a mail body which contains german
umlauts (ä,ö,ü).

When I receive the mail in Outlook 2003 (english operating system) I always
get a '|' or other similar symbols instead of the expected umlaut.

I'm using Sstem.Net.Mail and I already tried something like this:
string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail.AlternateView htmlView =
System.Net.Mail.AlternateView.CreateAlternateViewFromString(body,
Encoding.Unicode, "text/html");

mail.AlternateViews.Add(htmlView);

and also this:

string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail.AlternateView htmlView =
System.Net.Mail.AlternateView.CreateAlternateViewFromString(body,
Encoding.GetEncoding("iso-8859-1"), "text/html");

mail.AlternateViews.Add(htmlView);

In both cases I receive the wrong message body without the umlauts.

What am I doing wrong? Am I missing something?

Many thanks in advance,

Roberto Rocco.
 
M

Morten Wennevik

Hi Roberto,

Using MailMessage use the properties BodyEncoding and SubjectEndocing(2.0
only).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top