Possible reasons-
1. Incorrect Username and/or password
First you must check whether the Username and Password supplied are correct.
Though Gmail allows you to sign in with Username instead complete Email but when sending email through code you need to pass the complete Email address as Username.
2. SSL setting
Gmail uses secure channel for sending emails and you need to enable SSL security while sending emails through your application
In .Net it can be enabled by setting
EnableSsl
setting of the
SmtpClient
to
true
.
3. Less Secure Apps setting
If you are sure that your Username and Password are correct, but you still get errors then it means that Gmail has blocked your application.
If the reasons #1, #2 and #3 are not working for you then it might be the issue with the location of the Application accessing the Gmail account.
[Ripped from here][^]
-KR