Next, you have to enable External user support from Nextcloud Apps interface
In the end you need to configure additional user backends in Nextcloud’s configuration config/config.php using the following syntax:
..code-block:: bash
<?php
'user_backends' => array(
array(
'class' => 'OC_User_IMAP',
'arguments' => array(
'{imap.example.com:993/imap/ssl}', 'example.com'
),
),
),
If a domain name (e.g. example.com) is specified, then this makes sure that only users from this domain will be allowed to login.
After successfull login the domain part will be striped and the rest used as username in NextCloud. e.g. 'username@example.com' will be 'username' in NextCloud.