I'm attempting to send email using G Suite's SMTP relay service. Using C#, my code snippet looks like this:
string message = "<em>It's great to use HTML in mail!!</em>"
var client = new SmtpClient("smtp.gmail.com", 587);
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(_senderEmailAddress, _senderPassword);
client.EnableSsl = true;
client.Send(message);
However, this results in the following exception:
System.Net.Mail.SmtpException
HResult=0x80131500
Message=The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
I searched around and there are variety of security settings required by G Suite.
Any help anyone?
The above code and settings are CORRECT. The issue was that my password was not strong. I had been using a password tool to generate a password, which it declared as STRONG. However, G Suite did not. And shame on G Suite: it does not let you know.
User contributions licensed under CC BY-SA 3.0