473,396 Members | 1,827 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,396 software developers and data experts.

mail failed

hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?
Crespo
2006-06-30

Jun 30 '06 #1
6 2233
perhaps it is because you told hotmail that the mail message was an HTML
message in UTF-8 yet your message body is clearly not HTML or UTF-8.

That would explain what it failed to decode the message...

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?
Crespo
2006-06-30

Jun 30 '06 #2
Thanks for your answer. But following your advice,I set the
mailObj.IsBodyHtml as false and mailObj.BodyEncoding as
System.Text.Encoding.ASCII,it still failed with the same error message,Could
you further explain for me?

Crespo
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> дÈëÏûÏ¢
news:p9******************************@comcast.com. ..
perhaps it is because you told hotmail that the mail message was an HTML
message in UTF-8 yet your message body is clearly not HTML or UTF-8.

That would explain what it failed to decode the message...

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?
Crespo
2006-06-30


Jul 1 '06 #3
Thanks for your attention. In fact,my first code works well when I specify
some certain smtp servers,but doesn't work well over others which are even
correct smtp servers. Thank you very much anyway.
Crespo
"Crespo" <wu******@21cn.comдÈëÏûÏ¢
news:#9**************@TK2MSFTNGP05.phx.gbl...
Thanks for your answer. But following your advice,I set the
mailObj.IsBodyHtml as false and mailObj.BodyEncoding as
System.Text.Encoding.ASCII,it still failed with the same error
message,Could
you further explain for me?

Crespo
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.comдÈëÏûÏ¢
news:p9******************************@comcast.com. ..
perhaps it is because you told hotmail that the mail message was an HTML
message in UTF-8 yet your message body is clearly not HTML or UTF-8.

That would explain what it failed to decode the message...

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the
server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?
Crespo
2006-06-30


Jul 3 '06 #4
Perhaps my newsreader is just playing tricks on me. On my screen, the
following lines contain non-ASCII characters:
mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

So, setting the coding to ASCII doesn't help. To be honest, I made a
mistake when I said that it was not UTF-8. It does appear to be UTF-8. It
does not appear to be HTML, though.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.comwrote in message
news:uv**************@TK2MSFTNGP04.phx.gbl...
Thanks for your attention. In fact,my first code works well when I specify
some certain smtp servers,but doesn't work well over others which are even
correct smtp servers. Thank you very much anyway.
Crespo
"Crespo" <wu******@21cn.comдÈëÏûÏ¢
news:#9**************@TK2MSFTNGP05.phx.gbl...
>Thanks for your answer. But following your advice,I set the
mailObj.IsBodyHtml as false and mailObj.BodyEncoding as
System.Text.Encoding.ASCII,it still failed with the same error
message,Could
>you further explain for me?

Crespo
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.comдÈëÏûÏ¢
news:p9******************************@comcast.com ...
perhaps it is because you told hotmail that the mail message was an HTML
message in UTF-8 yet your message body is clearly not HTML or UTF-8.

That would explain what it failed to decode the message...

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the
server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?
Crespo
2006-06-30


Jul 3 '06 #5
Thank you for your kind advice. I have found the reason. In fact ,my codes
work well over some SMTP Server,but not over others. This is just because
some SMTP Server needs more authorization than common ones.Thank you anyway.

Best Regards

Crespo
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.comдÈëÏûÏ¢
news:kL******************************@comcast.com. ..
Perhaps my newsreader is just playing tricks on me. On my screen, the
following lines contain non-ASCII characters:
mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

So, setting the coding to ASCII doesn't help. To be honest, I made a
mistake when I said that it was not UTF-8. It does appear to be UTF-8.
It
does not appear to be HTML, though.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.comwrote in message
news:uv**************@TK2MSFTNGP04.phx.gbl...
Thanks for your attention. In fact,my first code works well when I
specify
some certain smtp servers,but doesn't work well over others which are
even
correct smtp servers. Thank you very much anyway.
Crespo
"Crespo" <wu******@21cn.comдÈëÏûÏ¢
news:#9**************@TK2MSFTNGP05.phx.gbl...
Thanks for your answer. But following your advice,I set the
mailObj.IsBodyHtml as false and mailObj.BodyEncoding as
System.Text.Encoding.ASCII,it still failed with the same error
message,Could
you further explain for me?

Crespo
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.comдÈëÏûÏ¢
news:p9******************************@comcast.com. ..
perhaps it is because you told hotmail that the mail message was an
HTML
message in UTF-8 yet your message body is clearly not HTML or UTF-8.

That would explain what it failed to decode the message...

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Zeeway" <ze****@gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
hi,everybody
I use dotnet 2005 and c sharp to deliever a mail to a certain mail
address,but it failed with messages such as "invalid parameter,the
server
response: decode failed". My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add("wu******@hotmail.com");
mailObj.From = new MailAddress(cr********@21cn.com);

mailObj.Subject = "Óʼþ²âÊÔ";
mailObj.Body = "ºÍѶÓʼþ½ÓÊÕ²âÊԳɹ¦! ";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;

System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient("smtp.21cn.com");
client.UseDefaultCredentials = false;

client.Credentials = new
System.Net.NetworkCredential("cr********@21cn.com" ,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

cr********@21cn.com is a correct account of mail.21cn.com,Could
anyone
help me?
Crespo
2006-06-30



Jul 6 '06 #6
"Zeeway" <ze****@gmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thank you for your kind advice. I have found the reason. In fact ,my codes
work well over some SMTP Server,but not over others. This is just because
some SMTP Server needs more authorization than common ones.Thank you
anyway.

Best Regards

Crespo
Sorry I couldn't be more help. I assume you have discovered how to send
authentication information to the SMTP server, since you did not ask for
further information.

Good Luck,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--


Jul 6 '06 #7

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

Similar topics

5
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. ...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
1
by: apasj06 | last post by:
hello everyone: I am trying to send email via php. I using window XP home edition. My mail client is outlook express. I configured mail client to send email via my aol email account. mail...
3
by: Dudely | last post by:
I'm trying to debug someone else's third party code that I'm trying to install on my site. It works for him on his site, but not for me on "my" site. I've traced the problem to the mail() call....
1
by: Nelliwinne | last post by:
I do not have proper excellence at php programming. I wrote below script after reading several articles. Anyway that form-to-mail script doesn't work. form action is connected to following code ...
7
by: redblue | last post by:
Hi all, i am new in php, I looked lots of example from Forum and tried online server but its nt work at all, i know i may be doing great mistake to sending HTML mail. last time i tried this code...
3
by: Prasad | last post by:
Hi all, I had to write a page in ASP which sends an email. I googled and was able to write the following code: <html> <body> <% Set Mail = Server.CreateObject("CDONTS.NewMail") Mail.To =...
1
dmjpro
by: dmjpro | last post by:
I am using SMTP mail server. I am sending a mail from SMTP client using Java Mail. But now i am getting this exception... Relaying denied. IP name possibly forged The debug informations given...
3
by: digitaldiva | last post by:
Hi I am new here and once upon a time I worked with Perl, now I am trying again and need some help: I wrote a Perl script a few years ago that opened an order entry TXT file and sent each...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.