The SMTP server requires a secure connection or the client was not authenticated

You use the Gmail mail server to send messages from the contact form on your website, and suddenly, you’re getting the dreadful error “The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required.” whereas your system has been working for years ?

I bumped into this issue starting about a month ago, and it spread to all the websites I created using Gmail as the email server.

What happened is that it seems Google changed the usage policy of its system for sending mail, and what previously allowed sending mail from your page by activating the option “Security > Access and data control > Less secure apps” no longer works.

The solution I got ? You have to start by activating 2-Step Verification in your Google Account and then creating app passwords.

For this purpose, go to https://myaccount.google.com/apppasswords and follow the instructions given here: https://support.google.com/mail/answer/185833?hl=en.

Hope it helps, at least that change worked for me

Thanks for sharing @Corobori.