473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MailMessage encoding

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 = "bi****@bishoy.com";
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 = "";
}
Nov 19 '05 #1
0 1314

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
4
by: Mark Rae | last post by:
Hi, Can anyone please tell me if it's possible to pass a System.Web.Mail.MailMessage object to a ASP.NET Web Service? Maybe using XML Serialization / Deserialization? I've been asked to...
1
by: Neven Klofutar | last post by:
Hi, I'm trying to change Encoding of an e-mail I'm sending after user submits the form. User can enter some special characters , so I need to send e-mail with Central European encoding >>...
1
by: MickeBoy | last post by:
Hi all! I'm trying to send a HTML mail using the MailMessage class. Sending the message works fine, but there is something funny with the received message. I use the code below to generate and...
0
by: Gerald S. | last post by:
MailMessage message = new MailMessage(from, to); message.Body = "Message body"; message.BodyEncoding = System.Text.Encoding.UTF8; message.Subject = "Subject"; message.SubjectEncoding =...
0
by: Kevin Hodgson | last post by:
I'm having a problem with System.Web.Mail.MailMessage losing linefeeds when creating an email. This is a VB.NET project. I use a stringbuilder to construct the MailMessage.Body and use vbCrLf...
1
by: Michel Couche | last post by:
Hello, I am starting the development of a newsletter The use of the class MailMessage of System.Net.Mail is quite straightforward for usual contact forms but my question here is "How can I...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
2
by: =?Utf-8?B?QW5kcmV3?= | last post by:
hi all, I have this code but it doesn't work. Can you help me ? MailMessage message = new MailMessage(); MailAddress MA_from = new MailAddress(msg.From, "WHOEVER",...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.