title: Error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required
body: <p>My website runs on port 443 and I have purchased a G Suite email account from google with my own domain name. This is my c# code:</p>
  
  <pre><code>        SmtpClient objSmtp = new SmtpClient("smtp.gmail.com", "587");
          objSmtp.UseDefaultCredentials = false;                      
          NetworkCredential NetCreds = new NetworkCredential("service@MyDomainName.com", "Pass");
          objSmtp.Credentials = NetCreds;
          objSmtp.EnableSsl = true;
  
          try
          {
              objSmtp.Send(objMail);                
          }
          catch(Exception ex)
          {                
              objSmtp.Send(objMail);                
          }
          finally
          {
              objMail.Dispose();
          }
  </code></pre>
  
  <p>I have enabled two-factor authentication and used the new generated password to authenticate. Also, I tried using a different port 465. No luck.</p>
  
  <p>When I used my personal Gmail "@gmail.com" account with Allow Less Secure Apps set to ON, it worked fine. Now, after buying into the G Suite subscription I am having issues. I am getting the following error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required." </p>
  
  <p>Can anyone spot the problem?</p>