Mail encoding problem

J

Jan Agermose

Im trying to send mail using this code:

MailMessage mail = new MailMessage();

mail.From = "(e-mail address removed)";

mail.Subject = "some subject";

mail.Priority = MailPriority.Normal;

mail.Body = body;

mail.BodyFormat = MailFormat.Text;

mail.To = to;

SmtpMail.SmtpServer = "XXXX";

SmtpMail.Send( mail );

Using the same SmtpServer the result if this is very different depending on
the client computer running the code. If using Danish chars "æøåÆØÅ" that
is. I guess this is due to different locale settings on the client
computers.

But how can I get passed this problem? I tried

mail.BodyEncoding = "iso-8859-1";

(and some other encodings)

But this makes it even worse.... This mail is unreadable on the reciving
end. What setting on the client computer sets the encoding on the mail -
what should I check to find the problem?



Jan Agermose
 
J

Jan Agermose

On the client that works this is part of the header information:

MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Mailer: Microsoft CDO for Windows 2000

And this is some of the headerinformation on the client that sends
unreadable mail

MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: base64
X-Mailer: Microsoft CDO for Windows 2000

How do I set "Content-Transfer-Encoding"????

Ragrds
Jan Agermose
 
J

Jacob Yang [MSFT]

Hi Jan,

I am not familiar with the Danish so I have not fully tested this issue.
Thank you for your understanding.

Based on my research and experience, please try to set the Encoding to
Unicode and test this issue again:

1. mail.BodyEncoding = Encoding.Unicode;

2. mail.BodyEncoding = Encoding.UTF8;

3. mail.BodyEncoding = Encoding.UTF7;

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top