SMTP configuration problems with Gmail server

Hi all, I work with Nextcloud since 2019, and after some adjustments, all works fine.
Recently I reinstall the server with ubuntu server 22.04 LTS and the newest rev. of nextcloud (24.0.5), PHP 8.1.2.
Thanks to my previous experience my first installation was better and easier than in the past.
But in this rev. I have some problems with the SMTP server configured with Gmail (I think the easiest part). I’m sure my Gmail configuration data are correct. I use these with other apps.
Server gives me the error:

First of all, why my account is converted in xxx@localhost.localdomain ?
Anyone can help me ?

hey @Twinsite

Have you searched the forum ahead of posting?
Why do I ask this, you think? Well there has been several discussions about Gmail and NC— I lost overview, actually but I remember clearly that G00gle changed the way of accessing their emails from outside during this year. It might have happened that they cut off 3rd-party clients, completely.
And then there was some thread where someone found a way to maybe get around with everything.

As I don’t have much time by now it would be nice if you would do the search yourself. And pls re–link the solving answer here as a solution

Yes, for sure I search many times and not only in Nextcloud community but nothing that can help me.
In particular, I use the same configuration two weeks ago in the previous installation. And before I had no problems. I think is not a matter from Gmai*.

manual tells me
The overwrite.cli.url parameter from config.php will be used for the SMTP EHLO.

so maybe you should check that?

Hello @Twinsite

Have you allowed “unsafe apps” in your Google account?

If not then you will not be able to use the SMTP feature and Google will block all attempts as a security measure.

Also you need to enable pop/imap features in the settings of your Gmail email account:

Kind regards

1 Like

‘overwrite.cli.url’ => ‘’,

It’s the internal IP of my NC server

that’s an IP and no URL… plus it’s only http and not https…

OK, no problem to introduce https:// but my URL is not accessible from the outside of my lan.

When I’m out, I connect to my lan trought a VPN and then to NC server directcly with the IP.

Have you set your email address on your Nextcloud account? This address is used to send the test email.

That they did… They broke many automated emails we use at work. We had to set up the Gmail relay service to work around it. This only works for Google Workspace domains.

The other option is to go to Google account security and enable less secure device access, set up 2FA, and then create an app password and use that to authenticate from Nextcloud. Not sure if that method still works or not.

Yes I have set my email in account configuration.
Yesterday try to use another SMTP server end it works. So the problem is between NC and G00gle.
I’m using G00gle, with 2 step authentication, with many other programs without problems.

Hello, your config is right, but you need to create a new “application password”. Gmail changed this year the way users access.

First go to:
Click on “Application password”
Create a new password to Email
Click on Device: “Other” and write a custom name, in my case: “NextCloud”
Click on Generate and copy the generated key to paste in the password box of NextCloud email config