Need Help Setting Up External IMAP Authentication In Nextcloud

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via, where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response, please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud Hub 5 (27.0.2)
Operating system and version (eg, Ubuntu 20.04): Linux 4.19.0-17-amd64 x86_64
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): Version: 8.1.21

The issue you are facing:

I work for a public library, our system admin set up a test server for Nextcloud, this is our first time ever using / testing it.

We want to be able to have library patrons & staff log into Nextcloud using their library email accounts, which are hosted on our servers, instead of having to manually create an account for everyone.

So, our system admin would like to be able to set Nextcloud to authenticate using IMAP.

I do not know how most of this works et cetera, we looked at the documentation:

User Authentication With IMAP, SMB, FTP And Others which references the readme for the External User Backends (user_external) app.

We looked at both of those, installed the External User Authentication App, made sure that it was enabled, and added a modified version of this code from the readme to an .ini file in /etc/php/8.1/apache2/conf.d:

‘user_backends’ => array(
‘class’ => ‘\OCA\UserExternal\IMAP’,
‘arguments’ => array(
‘’, 143 as the port, ‘null as the encryption type’, ‘our email domain’, true, false

Then we possibly used the command service apache2 reload.

Anyway, we need some help on this one, any help on figuring out how to get this working would be appreciated, and I can pass the information on to our system admin.

Thank you.

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):


The output of your Apache/nginx/system log in /var/log/____:



Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.