Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

mail failed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Crespo - 30 Jun 2006 03:50 GMT
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("wuhuanfa@hotmail.com");
        mailObj.From = new MailAddress(crespo1973@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("crespo1973@21cn.com",
this.tb_mailUserPassword.Text);
       client.DeliveryMethod = SmtpDeliveryMethod.Network;

       client.Send(mailObj);

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

 crespo1973@21cn.com is a correct account of mail.21cn.com,Could anyone
help me?

Crespo
2006-06-30

Nick Malik [Microsoft] - 30 Jun 2006 10:05 GMT
see answer in microsoft.public.dotnet.languages.csharp

Signature

--- 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.
--

> hi,everybody
>  I use dotnet 2005 and c sharp to deliever a mail to a certain mail
[quoted text clipped - 36 lines]
> Crespo
> 2006-06-30
Crespo - 01 Jul 2006 19:35 GMT
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
see answer in microsoft.public.dotnet.languages.csharp

Signature

--- 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.
--

> hi,everybody
>  I use dotnet 2005 and c sharp to deliever a mail to a certain mail
[quoted text clipped - 36 lines]
> Crespo
> 2006-06-30
Crespo - 03 Jul 2006 05:08 GMT
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

> Thanks for your answer. But following your advice,I set the
> mailObj.IsBodyHtml as false and mailObj.BodyEncoding as
[quoted text clipped - 44 lines]
> > Crespo
> > 2006-06-30

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.