Sharing files/dirs apparently fails with error "User not authenticated"

First of all: I already solved this problem.
But because it was such a misleading and time consuming issue I decided to share my problem and the solution, just in case someone else stumbles upon this.

Some infos about my Nextcloud

Nextcloud 15.0.0.10
Host OS Debian Stretch
Webserver Apache 2.4.25
Database Mariadb 10.1.37

Preconditions:

  1. “Settings - Basic settings - Email server - Authentication method” is set to “Login” with “Authentication required” and has correctly configured credentials
  2. An admin user “X” exists (name may be different)
  3. An user “Y” exists (name may be different)
  4. User “Y” has email notification enabled for new shares

Steps to reproduce:

  1. Login to Nextcloud as user “X”
  2. Go to Settings - Basic settings - Email server - Authentication method
  3. Uncheck “Authentication required”
  4. Note that corresponding textboxes below disappear
  5. Re-check “Authentication required”
  6. Note that textboxes re-appear including their content, except for the credentials which are empty!
  7. Leave “Settings” and go to “Files”
  8. Choose an arbitrary file and click on the share icon
  9. Type in “Y” and click on the auto-completion overlay that appears
  10. Note that the user “Y” does not appear in the “shared-with-list” below as expected! Instead a temporary notification is shown at the top of the browser viewport: Expected response code 250 but got code “530”, with message "530 5.7.0 User not authenticated"
  11. Reload the website
  12. Choose the same file again and click on the share icon
  13. Note that now the user “Y” is included in the shared-with-list

Solution:

  1. Go to Settings - Basic settings - Email server - Authentication method
  2. Enter valid credentials

Analysis of the problem:
When initiating the sharing, the swiftmailer app trys to login to the mail server to send user “Y” a mail. The login fails and obstructs the GUI update. The notification “User not authenticated” is in this context misleading, as it indicates that something is wrong with the Nextcloud user sharing settings.

Final thoughts:
Before anyone complains: Yes, its not a bug in Nextcloud but an issue caused by misconfiguration. Maybe I could have been more careful checking the impact of disabling and re-enabling the “Authentication required” checkbox. Please keep in mind why I posted this. Maybe the notification text will be indexed by Google and spare someone else hours of creating test users, inspecting the db-content and grep-ing through Nextclouds sourcecode. :wink: