I am trying to connect to an smtp server that requires authentication.
This is the C# code i am using to send the email:
var smtpClient = new SmtpClient();
smtpClient.Host = _smtpServerHost;
smtpClient.Credentials = new NetworkCredential(_username, _password);
smtpClient.UseDefaultCredentials = false;
smtpClient.Send(GetMessage());
The send function raised the error:
The SMTP server requires a secure connection or the client was not authenticated.
The server response was: Must authenticate before sending mail
Is there a step that I am missing to connect to the smtp server?
I tried to connect to a test server we have running but that didn't work. I also tried to connect to smtp4dev. I can connect to it when I am not requiring authentication, but not when i am requiring auth.