Help: Sharing IMAP folder from a mdbox mailbox to a maildir mailbox
Dear all,
I'm configuring Dovecot 2.4.1 with per-user mailbox format support, but cannot get user shared mailbox working between different mailbox formats.
- Account mdbox@domain.com is a mdbox format mailbox, access with webmail is ok.
- Account maildir@domain.com is a maildir format mailbox, access with webmail is ok.
- mdbox@ shares its Sent folder to maildir@ with Roundcube webmail,
grants all privileges (
akxeilprwts
).
The result is maildir@ cannot see the shared folder.
- No error reported in Dovecot log file.
- mysql logs the queries performed to get user shared mailbox, i ran the query manually and it returns correct result like this:
MariaDB [vmail]> SELECT dummy,from_user FROM share_folder WHERE to_user = 'maildir@domain.com' \G
*************************** 1. row ***************************
dummy: 1
from_user: mdbox@domain.com
dovecot.conf snippet attached below. I think the "mail_*" parameters inside
namespace shared {}
block are incorrect to handle mixed
mailbox formats because it hard-codes the mail_driver and mail_path, tried all
possible parameters i can imagine, but failed.
Thanks for helping. :)
------------------------
mail_plugins { acl = yes ... }
protocol imap { mail_plugins { imap_acl = yes ... } ... }
mail_driver = %{userdb:mail_driver | default("maildir") | lower} mail_path = %{userdb:mail_path | default("~/Maildir")}
sql_driver = mysql mysql 127.0.0.1 { port = ... dbname = ... user = ... password = ... }
userdb sql {
# ... omit other lines ...
query = SELECT
LOWER('%{user | lower}') AS master_user,
LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home,
mailbox.mailboxformat AS mail_driver,
CONCAT("~/", mailbox.mailboxfolder) AS mail_path,
CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule
FROM ...
}
namespace shared { type = shared separator = / prefix = Shared/$user/ subscriptions = yes list = children
mail_driver = maildir
mail_path = %{owner_home}/Maildir
mail_index_private_path = ~/Maildir/shared/%{owner_user}
# not share the index files between users
mail_index_path = ~/Maildir/shared/%{owner_user}
}
acl_driver = vfile acl_globals_only = no
acl_sharing_map { dict proxy { name = acl } }
dict_server { dict acl { driver = sql
dict_map shared/shared-boxes/user/$to/$from {
sql_table = share_folder
value_field dummy {
}
key_field from_user {
value = $from
}
key_field to_user {
value = $to
}
}
dict_map shared/shared-boxes/anyone/$from {
sql_table = anyone_shares
value_field dummy {
}
key_field from_user {
value = $from
}
}
}
...
}
------------------------
On 05/09/2025 04:46 EEST Zhang Huangbin via dovecot <dovecot@dovecot.org> wrote:
Dear all,
I'm configuring Dovecot 2.4.1 with per-user mailbox format support, but cannot get user shared mailbox working between different mailbox formats.
- Account mdbox@domain.com is a mdbox format mailbox, access with webmail is ok.
- Account maildir@domain.com is a maildir format mailbox, access with webmail is ok.
- mdbox@ shares its Sent folder to maildir@ with Roundcube webmail, grants all privileges (
akxeilprwts
).The result is maildir@ cannot see the shared folder.
- No error reported in Dovecot log file.
- mysql logs the queries performed to get user shared mailbox, i ran the query manually and it returns correct result like this:
MariaDB [vmail]> SELECT dummy,from_user FROM share_folder WHERE to_user = 'maildir@domain.com' \G *************************** 1. row *************************** dummy: 1 from_user: mdbox@domain.com
dovecot.conf snippet attached below. I think the "mail_*" parameters inside
namespace shared {}
block are incorrect to handle mixed mailbox formats because it hard-codes the mail_driver and mail_path, tried all possible parameters i can imagine, but failed.Thanks for helping. :)
Running mixed system with shared folders is going to indeed be very difficult and I would strongly recommend against it. It sounds to me that you should migrate to new server with new config and just one mailbox format first.
Aki
On Sep 5, 2025, at 13:05, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
Running mixed system with shared folders is going to indeed be very difficult and I would strongly recommend against it. It sounds to me that you should migrate to new server with new config and just one mailbox format first.
Hi Aki,
Thanks for helping.
We migrated some accounts with large mailboxes to mdbox for better performance, hence we have mixed mailbox formats on same server.
- Would you mind sharing what the difficulties are in this case?
- Can we get it work if userdb returns required information?
- Does it mean user shared mailbox only works with maildir format mailbox?
- Does it work with Dovecot 2.3? I didn't try it before with 2.3, but since we have mixed mailbox formats in production, i tested it with 2.4 while migrating and experiencing this issue.
On 05/09/2025 09:36 EEST Zhang Huangbin via dovecot <dovecot@dovecot.org> wrote:
On Sep 5, 2025, at 13:05, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
Running mixed system with shared folders is going to indeed be very difficult and I would strongly recommend against it. It sounds to me that you should migrate to new server with new config and just one mailbox format first.
Hi Aki,
Thanks for helping.
We migrated some accounts with large mailboxes to mdbox for better performance, hence we have mixed mailbox formats on same server.
- Would you mind sharing what the difficulties are in this case?
- Can we get it work if userdb returns required information?
- Does it mean user shared mailbox only works with maildir format mailbox?
- Does it work with Dovecot 2.3? I didn't try it before with 2.3, but since we have mixed mailbox formats in production, i tested it with 2.4 while migrating and experiencing this issue.
You can try to make it work *but* it requires that everyone has the *same* root folder for mails (mail_path). If you use something like mdbox/ and maildir/, it's not going to be possible to make it work. So use something like mail/
.
Once everyone has same mail root folder, you can try to use mail_driver=auto in namespace shared. Don't use this for namespace inbox, because it will behave unexpectedly (for you) if the mailbox does not exist.
You will run into exact same issues with 2.3 and 2.4. The problem is that the shared namespace cannot know what the target user is using for mail path if you don't use the same path.
Aki
On Sep 5, 2025, at 14:54, Aki Tuomi via dovecot <dovecot@dovecot.org> wrote:
You can try to make it work *but* it requires that everyone has the *same* root folder for mails (mail_path). If you use something like mdbox/ and maildir/, it's not going to be possible to make it work. So use something like
mail/
.
We store mailbox format and folder name in SQL like below:
MariaDB [vmail]> select username,mailboxformat,mailboxfolder from mailbox \G
*************************** 1. row ***************************
username: maildir@a.io
mailboxformat: maildir
mailboxfolder: Maildir
*************************** 2. row ***************************
username: mdbox@a.io
mailboxformat: mdbox
mailboxfolder: mdbox
I also updated userdb to query and return them, then use them in
namespace shared {}
like %{userdb:mailboxformat}
, %{userdb:mailboxfolder}
,
doesn't work either.
Once everyone has same mail root folder, you can try to use mail_driver=auto in namespace shared. Don't use this for namespace inbox, because it will behave unexpectedly (for you) if the mailbox does not exist.
You will run into exact same issues with 2.3 and 2.4. The problem is that the shared namespace cannot know what the target user is using for mail path if you don't use the same path.
Doc mentions variables like %{owner_home}
, %{owner_user}
, will it
work perfectly if Dovecot exports owner's mail_driver
and mail_path
with variables like %{owner_mail_driver}
, %{owner_mail_path}
?
On 05/09/2025 10:13 EEST Zhang Huangbin via dovecot <dovecot@dovecot.org> wrote:
On Sep 5, 2025, at 14:54, Aki Tuomi via dovecot <dovecot@dovecot.org> wrote:
You can try to make it work *but* it requires that everyone has the *same* root folder for mails (mail_path). If you use something like mdbox/ and maildir/, it's not going to be possible to make it work. So use something like
mail/
.We store mailbox format and folder name in SQL like below:
MariaDB [vmail]> select username,mailboxformat,mailboxfolder from mailbox \G *************************** 1. row *************************** username: maildir@a.io mailboxformat: maildir mailboxfolder: Maildir *************************** 2. row *************************** username: mdbox@a.io mailboxformat: mdbox mailboxfolder: mdbox
I also updated userdb to query and return them, then use them in
namespace shared {}
like%{userdb:mailboxformat}
,%{userdb:mailboxfolder}
, doesn't work either.Once everyone has same mail root folder, you can try to use mail_driver=auto in namespace shared. Don't use this for namespace inbox, because it will behave unexpectedly (for you) if the mailbox does not exist.
You will run into exact same issues with 2.3 and 2.4. The problem is that the shared namespace cannot know what the target user is using for mail path if you don't use the same path.
Doc mentions variables like
%{owner_home}
,%{owner_user}
, will it work perfectly if Dovecot exports owner'smail_driver
andmail_path
with variables like%{owner_mail_driver}
,%{owner_mail_path}
?
There are no such variables. There is only owner_home and owner_user. It will most likely work the way I explained to you.
Aki
On Sep 5, 2025, at 15:25, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
There are no such variables.
I know. What i mean is, what if Dovecot adds / supports them, will it work? For example:
namespace {
type = shared
# ... omit other lines ...
mail_driver = %{owner_mail_driver}
mail_path = %{owner_mail_path}
mail_index_private_path = %{mail_path}/shared/%{owner_user}
mail_index_path = %{mail_path}/shared/%{owner_user}
}
On 05/09/2025 10:34 EEST Zhang Huangbin via dovecot <dovecot@dovecot.org> wrote:
On Sep 5, 2025, at 15:25, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
There are no such variables.
I know. What i mean is, what if Dovecot adds / supports them, will it work? For example:
namespace { type = shared # ... omit other lines ... mail_driver = %{owner_mail_driver} mail_path = %{owner_mail_path} mail_index_private_path = %{mail_path}/shared/%{owner_user} mail_index_path = %{mail_path}/shared/%{owner_user} }
I don't see any good reason why we would want to add this.
Aki
Le 2025-09-05 09:42, Zhang Huangbin via dovecot a écrit :
On Sep 5, 2025, at 15:39, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
I don't see any good reason why we would want to add this.
Supporting user shared mailbox with any mailbox driver. is it good enough? :)
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Le 2025-09-05 09:42, Zhang Huangbin via dovecot a ecrit :
On Sep 5, 2025, at 15:39, Aki Tuomi <[1]aki.tuomi@open-xchange.com>
wrote:
I don't see any good reason why we would want to add this.
Supporting user shared mailbox with any mailbox driver. is it good
enough? :)
_______________________________________________
dovecot mailing list -- [2]dovecot@dovecot.org
To unsubscribe send an email to [3]dovecot-leave@dovecot.org
References
Visible links
- mailto:aki.tuomi@open-xchange.com
- mailto:dovecot@dovecot.org
- mailto:dovecot-leave@dovecot.org
Try to install two dovecot services, one with config using maildir and other mbox.
Set shared folder in config with same path and each use different port and different webmail installation on different domain mbox.domain.com and maildir.domain.com, for mbox configure e.g. imap ports to use mbox dovecot instance ports and vice versa for maildir.
This might work, if not I hope you find way in getting it to work perhaps take snapshot of dovecot dir and add content in both maildir and mbox and see dovecot differences, and find all the anomalies in changes, and write script runs every second, whenever any mbox or maildir has new entry, sync it in the other. I guess this should work.
Zak.
On 2025-09-05 08:42, Zhang Huangbin via dovecot wrote:
On Sep 5, 2025, at 15:39, Aki Tuomi wrote:
I don't see any good reason why we would want to add this.
Supporting user shared mailbox with any mailbox driver. is it good enough? :)
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
Try to install two dovecot services, one with config using maildir and other mbox.
Set shared folder in config with same path and each use different port and different webmail installation on different domain mbox.domain.com and maildir.domain.com, for mbox configure e.g. imap ports to use mbox dovecot instance ports and vice versa for maildir.
This might work, if not I hope you find way in getting it to work perhaps take snapshot of dovecot dir and add content in both maildir and mbox and see dovecot differences, and find all the anomalies in changes, and write script runs every second, whenever any mbox or maildir has new entry, sync it in the other. I guess this should work.
Zak.
On 2025-09-05 08:42, Zhang Huangbin via dovecot wrote:
On Sep 5, 2025, at 15:39, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
I don't see any good reason why we would want to add this.
Supporting user shared mailbox with any mailbox driver. is it good enough? :)
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
participants (4)
-
Aki Tuomi
-
lolomin@minost.fr
-
Zakaria
-
Zhang Huangbin