Error "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required"
Hi, I'm trying to send an email via the SMTP server using C# code but getting the following error:"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required"
I know the username and password are correct and I can login via the web interface an send email via this account no problems. Here is my code - can any body shed any light on why this would happen? Putting an invalid password gives the same error. I also have disabled TFA.
SmtpClient smtp = new SmtpClient("smtp.zoho.com", 587);
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("user@domain.com", "password");
MailMessage msg = new MailMessage("user@domain.com", "toaddress@adomain.com");
msg.Subject = "hello";
msg.Body = "world";
smtp.Send(msg);