Click here to Skip to main content
15,887,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I have hosted an application on the server called ParallelsPlesk Panel when i am sending mail from the application which is hosted i am receiving this error
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

Username and password is correct is correct


But when i run the application on my local pc it is running properly mail are being sent
can anyone tell what might be the problem


//This is the mail code
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();//instantiate mail message
SmtpClient smtp = new SmtpClient();
mail.To.Add("surajfg@gmail.com");
mail.From = new MailAddress("isptestmail@gmail.com");
mail.Subject = "Subject";
mail.IsBodyHtml = true;
mail.Body = "Message";
smtp.Host = "smtp.gmail.com";

smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential("isptestmail@gmail.com", "Secret");
smtp.EnableSsl = true;

smtp.Send(mail);
Posted
Comments
TrushnaK 21-Aug-13 7:51am    
are you sure about your mail id and password?
surajemo 21-Aug-13 7:59am    
yes :)
[no name] 21-Aug-13 8:02am    
Where are you setting the port number for gmail?
surajemo 21-Aug-13 8:29am    
i am not setting anything in the port
[no name] 21-Aug-13 8:33am    
Then maybe you should try that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900