[GH-ISSUE #866] customizing LDAP auto mailbox creation #767

Closed
opened 2026-02-27 11:13:27 +03:00 by kerem · 4 comments
Owner

Originally created by @maziyarpanahi on GitHub (Apr 29, 2016).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/866

Hello,

Where can I change the setting for auto mailbox creation when the user logs in for the first time instead of /srv/vmail/ldap/uid(ldap usernam) creates the mailbox in /srv/vmail/domainname/firstPartOfEmail(%n)?

I have tried dovecot-ldap.conf.ext and also 10-mail.conf to match them with the default format (../ldap/uid) but I still get the error that says it can't find the user in /srv/vmail/domain/%n

The only place that had an effect in this error was a MySQL config (dovecot-sql.conf.ext). But I still have to change the default LDAP mailbox creation path and parameters. My LDAP userName is not the same as the user's email address.

Details of error:

Apr 29 10:45:14 mail dovecot: lmtp(24413, romain.reuillon@iscpif.fr):
Error: user romain.reuillon@iscpif.fr: Initialization failed: Namespace
'': Mail storage autodetection failed with
home=/srv/vmail/iscpif.fr/romain.reuillon

When user logs in for the first time it creates the mailbox in /srv/vmail/ldap/uid which is different that its email username without domain.

Many thanks.

Originally created by @maziyarpanahi on GitHub (Apr 29, 2016). Original GitHub issue: https://github.com/modoboa/modoboa/issues/866 Hello, Where can I change the setting for auto mailbox creation when the user logs in for the first time instead of /srv/vmail/ldap/uid(ldap usernam) creates the mailbox in /srv/vmail/domainname/firstPartOfEmail(%n)? I have tried dovecot-ldap.conf.ext and also 10-mail.conf to match them with the default format (../ldap/uid) but I still get the error that says it can't find the user in /srv/vmail/domain/%n The only place that had an effect in this error was a MySQL config (dovecot-sql.conf.ext). But I still have to change the default LDAP mailbox creation path and parameters. My LDAP userName is not the same as the user's email address. Details of error: ``` Apr 29 10:45:14 mail dovecot: lmtp(24413, romain.reuillon@iscpif.fr): Error: user romain.reuillon@iscpif.fr: Initialization failed: Namespace '': Mail storage autodetection failed with home=/srv/vmail/iscpif.fr/romain.reuillon ``` When user logs in for the first time it creates the mailbox in /srv/vmail/ldap/uid which is different that its email username without domain. Many thanks.
kerem closed this issue 2026-02-27 11:13:27 +03:00
Author
Owner

@tonioo commented on GitHub (Apr 29, 2016):

Modoboa does not create mailboxes on the filesystem, dovecot does.

If you haven't modified the default configuration, the mailbox path is returned by the SQL query used with user_query in dovecot's configuration (http://modoboa.readthedocs.io/en/latest/integration/imap_and_smtp.html#mysql-users)

In your example, I don't understand where does the 'ldap' part come from...

<!-- gh-comment-id:215668699 --> @tonioo commented on GitHub (Apr 29, 2016): Modoboa does not create mailboxes on the filesystem, dovecot does. If you haven't modified the default configuration, the mailbox path is returned by the SQL query used with user_query in dovecot's configuration (http://modoboa.readthedocs.io/en/latest/integration/imap_and_smtp.html#mysql-users) In your example, I don't understand where does the 'ldap' part come from...
Author
Owner

@maziyarpanahi commented on GitHub (Apr 29, 2016):

Hi tonioo,

Thanks for your reply. Actually the /ldap part was coming from "dovecot-ldap.conf.ext" that I have set manually. I am trying to make this config as same as user_query (I don't want to change sql query). So I need to assign user's email address instead of LDAP username which is different in my LDAP:

user_attrs =
uidNumber=uid,gidNumber=gid,homeDirectory=home=/srv/vmail/iscpif.fr/%n,uid=mail=maildir:/srv/vmail/iscpif.fr/%$/Maildir,=namespace/default/separator=%{ldap:mailSeparator}

Any chance you know how to get user's LDAP email address? If I can find the parameter for LDAP user's email address instead of %n it will match the user_query.

Many thanks again tonioo

<!-- gh-comment-id:215677293 --> @maziyarpanahi commented on GitHub (Apr 29, 2016): Hi tonioo, Thanks for your reply. Actually the /ldap part was coming from "dovecot-ldap.conf.ext" that I have set manually. I am trying to make this config as same as user_query (I don't want to change sql query). So I need to assign user's email address instead of LDAP username which is different in my LDAP: ``` user_attrs = uidNumber=uid,gidNumber=gid,homeDirectory=home=/srv/vmail/iscpif.fr/%n,uid=mail=maildir:/srv/vmail/iscpif.fr/%$/Maildir,=namespace/default/separator=%{ldap:mailSeparator} ``` Any chance you know how to get user's LDAP email address? If I can find the parameter for LDAP user's email address instead of %n it will match the user_query. Many thanks again tonioo
Author
Owner

@maziyarpanahi commented on GitHub (Apr 29, 2016):

Ok I have managed to get the email address on both mailBox creation and user_query.

Many thanks again tonioo

<!-- gh-comment-id:215697878 --> @maziyarpanahi commented on GitHub (Apr 29, 2016): Ok I have managed to get the email address on both mailBox creation and user_query. Many thanks again tonioo
Author
Owner

@tonioo commented on GitHub (Apr 29, 2016):

Nice! I was replying to you but you were faster than me :)

Could you paste a working example? So others can retrieve it if they need too?

Thanks!

<!-- gh-comment-id:215698055 --> @tonioo commented on GitHub (Apr 29, 2016): Nice! I was replying to you but you were faster than me :) Could you paste a working example? So others can retrieve it if they need too? Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#767
No description provided.