MailMessage encoding

B

Bishoy George

I have a form to mail by C#, and it works properly.
My problem is: when any visitor writes letters other than English
letters --- it comes as ??????
How to fix this encoding problem?


--------------------------- my code-----------------------------

using System.Web.Mail;

private void btnSend_Click(object sender, System.EventArgs e)
{
MailMessage msg = new MailMessage();
msg.From = txtName.Text + "<" + txtEmail.Text + ">";
msg.To = "(e-mail address removed)";
msg.Subject = "bishoy.com: " + txtSubject.Text;
msg.Body = txtMessage.Text;

SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(msg);

lblThanks.Text = "Thank you " + txtName.Text + " your message has been
sent successfully.";
txtName.Text = "";
txtEmail.Text = "";
txtSubject.Text = "";
txtMessage.Text = "";
}
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,286
Latest member
ChristieSo

Latest Threads

Top