IMAP auth - login without domain name?

Hi community,

I just installed nextcloud and managed to auth against IMAP.

Now I want to give user the convenience to just login with their adress without the domain name, so with “user” instead of “user@domain.tld”. All users on this nextcloud come from the same domain.

For sure the imap server needs the domain name (or doesn’t he?). Is there maybe anything with the arguments I give in the config.php (maybe with the /user option)?? I’m not a programmer, so I need help with these arguments.

Thanks in advance!
Boas

It depends on your imap server if the domain is needed in the username. As far as I have seen in the documentation, you can’t set a default domain for auto-completion. But feel free to put a feature request on github or even implement it yourself.

HI tflidd,

thanks for the hint. The IMAP-server is dovecot and I managed to solve this. You can add to the dovecot config the line

auth_default_realm = <YOURDOMAIN.TLD>

and then you don’t need the domain.

So for one domain on a server the problem is solved!

The next issue is that I run several domains on that server and the above solution only works for on domain on that server. So I need to investigate further …

Anyway, thanks for the hint, any comment is appreciated!

Boas

Was just looking into this found out from github Just add your domain to the end of the arguments array as below with appended.domain.name

'user_backends' => array(
    array(
        'class' => 'OC_User_IMAP',
        'arguments' => array(
            '{127.0.0.1:143/imap/readonly}', 'appended.domain.name'
        ),
    ),
),

Just thought I should note my experience with this

With the web interface you can log in as user or user@example.com either way you login as user

BUT WITH APP PASSWORDS

If you log in as user@example.com your app password will be generated as user@example.com

If you log in as user your app passwords will be generated as user

Hi, I’m sorry if I am taking you backwards; I have just install the nextcloud and I am happy with what I have seen so far but the problem is that, I need it to work with a mail server. From what I have seen here it means you have been able to solve that problem. Is it possible to point me in the right direction? I am thinking of installing postfix and Dovecot in thesame server with nextcloud to handle the mail side of things but one question is that how can I do the installation is such as way that Dovecot uses nextcloud userdb

postfix and Dovecot or Exim4 and Dovecot

Technically speaking you can have dovecot check the nextcloud user db for login as it’s sql addon has customizable lookup commands. I would however recommend against this as it’s a bit of a pain in the ass if you are unfamiliar with lookup commands/db’s. The External Auth with IMAP is a less breakable option in my opinion.

Also postfix and dovecot configs are complicated so rolling your own setup is generally not recommended unless you really, really know what you are doing. using a pre-packaged setup like mailcow, mail-in-a-box or modoboa is generally a much better option as they have sane configs by default and are much more fool proof.

I personally use modoboa, I don’t have it installed on the same Virtual Machine as my nextcloud install but as modoboa uses nginx as the web server it’s relatively simple to run both on the same system.

** A Note on the IMAP auth I have experienced so far. If my mail server is down/inaccessible if anything attempted to log in to nextcloud with an app password, the app password is invalidated, it’s kinda annoying.

Thanks for your help, I will have a go with modoboa, if I have any problem, I will let you know

I have installed the modoboa mail server which is pretty straightforward but the problem is how do I get it to connect to the mail client in nextcloud; I would appreciate any help thanks

Thanks

I use the email address as a login user@example.com,
I log as user@example.com
but in the app it shows me user @ user.com @ drive.example.com

You have to login as initially as user not user@example.com. After that you can use either username to login. I don’t think there is a way of changing the username after the fact. Luckily copying files to a new username isn’t a major issue (Calendar and contacts Need separate backing up)

I’m presuming you are referring to the mail app? You connect like any IMAP server using port 993 SSL/TLS. If it’s on the same server just make sure your mail domain name is in your /etc/hosts file:

127.0.0.1    localhost
127.0.0.1    mail.example.com

I should mention I had to add timeout’s to the config.php to get the mail app to send emails without errors.

'app.mail.imap.timeout' => 30,
'app.mail.smtp.timeout' => 15,

And also when setting nextcloud notification emails this timeout was needed

'mail_smtptimeout' => 30,