468,512 Members | 1,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Send email problem when hosting

4
Hi,

I rented a host. At localhost, i can control send email from this host to my email. However, when i hosting, it appears the below error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: host5.vdconline.vn ESMTP MailEnable Service, Version: 5.51-- denied access at 02/03/12 02:45:26

My code looks like:

Expand|Select|Wrap|Line Numbers
  1. if( dr != null)
  2.             dr.Close();
  3.         string mail = "select PassWord from UserTable where email = "+"'"+TextBox1.Text+"'";
  4.         cmd = new SqlCommand(mail, conn);
  5.         cmd.ExecuteNonQuery();
  6.         dr = cmd.ExecuteReader();
  7.         dr.Read();
  8.  
  9.         MailMessage msg = new MailMessage();
  10.         SmtpClient smtp = new SmtpClient("*.*.*.*", 25);        
  11.         msg.From = new MailAddress("*@*.*");        
  12.         msg.To.Add(new MailAddress(TextBox1.Text));
  13.         msg.Subject = "Recover password.";
  14.         msg.Body = "Your password: " + dr[0].ToString();
  15.         msg.IsBodyHtml = true;
  16.  
  17.         smtp.EnableSsl = true;      
  18.         smtp.UseDefaultCredentials = false;
  19.         smtp.Credentials = new NetworkCredential("*@*.*", "******");  
  20.         try
  21.         {
  22.             smtp.Send(msg);
  23.             Label3.Text = "Email sent successfully";
  24.         }
  25.         catch (Exception ex)
  26.         {
  27.             Label3.Text = ""+ex.Message;
  28.         }
  29.  
Thanks in advance!
Feb 3 '12 #1
0 1235

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Bruce W.1 | last post: by
2 posts views Thread by Ron | last post: by
5 posts views Thread by Andy G | last post: by
reply views Thread by majahops via WebmasterKB.com | last post: by
34 posts views Thread by majahops via WebmasterKB.com | last post: by
5 posts views Thread by canajien | last post: by
reply views Thread by canajien | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.