"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at"
So what exactly this error and what is the solution. Her are few regions
1. When your server and the mail id are having different time zone
Solution of this error.
As you try to send email through your code. Gmail will send a mail to your account as a warning in you email account you have provided in code. Here is the email which you get.
Now click on Button " SECURE YOUR ACCOUNT". After click below screen will appear. By default it's "Turn off" selected . Now select Turn on option
Now we have done. Enjoy your code and Gmail as SMTP server.