Invalid SMTP password

I have been looking at Email server settings for a while now and noticed a problem with the NC UI not allowing me to set up NC email.

Admin > Settings > Basic Settings > Email server

I click the save button here and it says “Invalid SMTP password”. But when I click on the “Send Email” button below it, the email is sent with no problem.
Immediately after I enter my (correct or incorrect) password, it says “save”. If I click “Save” without entering the password thereafter, it shows “Invalid”.

When I looked at the groupware setup, the description under “Send Invitations to attendees” said, “Please make sure to properly set up the email server.” and I noticed this.

What is the solution to this?

Nextcloud 24.0.4, PHP 8.0.23, nginx 1.20.2, CentOS 7.9

Check the SMTP server’s log.
Maybe you did set wrong SMTP port and/or encryption.

I’m using SMTP on a shared server and can’t see the SMTP logs.
I tried setting up a different mail server once and still get this error.
NC 24.0.5 was released and I updated mine. However, it did not improve.

The password field shows “Save” immediately after I enter the correct password, no matter how many times I click the save button.
However, if I reload the NC in my browser and click the Save button without changing it, it shows invalid.

Also, when I enter the correct password and click the save button and go to “Overview” immediately after “Save” appears, NC’s system validation feature tells me that my email has not been set/validated. Of course, even if an “Invalid SMTP password” is displayed, the test mail itself will be delivered without any problem.

I have found a stopgap solution.

  1. Edit config.php directly and remove mail-related items.
  2. Restart PHP-FPM
  3. Configure email settings in the NC Web UI.
  4. Send a test email.

In this order, at least the system validation in Overview passes. However, the description of the “Send invitations to participants” item in the groupware settings shows “Please make sure to properly set up”.
When I create an event in the calendar and invite users, they receive the invitation email with no problem.

Then I go back to Basic Settings and I enter the correct email password and it still says “Invalid SMTP password” but the system verification remains passed.