I am using ZOHO mail server for sending mails through my application. But it gives following error -
"TheSMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required."
my code -
- MailMessage msg = new MailMessage();
- msg.To.Add(new MailAddress("[email protected]"));
- msg.Bcc.Add(new MailAddress("[email protected]"));
- msg.From = new MailAddress("[email protected]", "Test mail");
- msg.Subject = "send mail";
- msg.Body = "test MAIL....";
- msg.IsBodyHtml = true;
- SmtpClient client = new SmtpClient();
- client.Host = "smtp.zoho.com";
- client.Credentials = new System.Net.NetworkCredential("[email protected]", "XXX");
- client.Port = 587;
- client.EnableSsl = true;
- client.Send(msg);
please give a solution ..