IRedMail/FAQ/Share.IMAP.Folder
From iRedMail
(→References) |
|||
| Line 105: | Line 105: | ||
= Test shared folder = | = Test shared folder = | ||
| - | Please restart dovecot and apache web server after you modified dovecot and roundcube. | + | Note: |
| + | * Please restart dovecot and apache web server after you modified dovecot and roundcube. | ||
| + | * For Roundcube user, there's a plugin available for roundcube-0.5, it's easy to let user manage their mailbox sharing. | ||
| + | * For Thunderbird user, there's a add-on available too. | ||
| - | * Set a share folder with telnet | + | Test steps: |
| + | * Set a share folder with telnet. | ||
{{cmd|<pre> | {{cmd|<pre> | ||
Revision as of 08:28, 19 January 2011
Contents |
Note: Mailbox sharing is enabled by default in iRedMail-0.7.0.
Summary
With Dovecot-1.2, it's possible to share your IMAP folders to other users. This article describes:
- How to enable mailbox sharing in Dovecot
- How to enable mailbox sharing in Roundcube webmail.
- How to test mailbox sharing with telnet
Requirements
- Dovecot >= 1.2. If you're using 1.1, please follow this detail tutorial to upgrade it.
- Roundcube Webmail >= 0.5 -stable release.
Configure Dovecot
- Add ACL plugins in lda and imap:
| File: dovecot.conf |
protocol lda {
mail_plugins = ... acl
}
protocol imap {
mail_plugins = ... acl imap_acl
}
|
- Add necessary NAMESPACE and ACL config:
| File: dovecot.conf |
namespace private {
separator = /
prefix =
#location defaults to mail_location.
inbox = yes
}
namespace shared {
separator = /
prefix = shared/%%u/
location = maildir:/%%Lh/Maildir/:INDEX=/%L%h/Maildir/shared/%%u
subscriptions = no
list = children
}
plugin {
acl = vfile
}
|
With the above configuration it's possible to open shared mailboxes if you know their name, but they won't be visible in the mailbox list. This is because Dovecot has no way of knowing what users have shared mailboxes to whom. Iterating through all users and looking inside their mail directories would be horribly inefficient for more than a couple users.
To overcome this problem Dovecot needs a dictionary, which contains the list of users who have shared mailboxes and to whom they have shared. If the users aren't properly listed in this dictionary, their shared mailboxes won't be visible. Currently there's no way to automatically rebuild this dictionary, so make sure it doesn't get lost. If it does, each user having shared mailboxes must use the IMAP SETACL command (see below) to get the dictionary updated for themselves.
| File: dovecot.conf |
plugin {
acl_shared_dict = proxy::acl
}
dict {
acl = mysql:/etc/dovecot/dovecot-share-folder.conf
}
|
- Create mysql lookup file: /etc/dovecot/dovecot-share-folder.conf:
| File: /etc/dovecot/dovecot-share-folder.conf |
connect = host=localhost dbname=vmail user=vmailadmin password=cZ0LFtKO7eqXzOzxruwbZ4h2F2PqkJ
map {
pattern = shared/shared-boxes/user/$to/$from
table = share_folder
value_field = dummy
fields {
from_user = $from
to_user = $to
}
}
|
Note: MySQL user name must be vmailadmin or other users which have read/write privileges.
- Create database in MySQL database: vmail.
| Terminal: |
$ mysql -uroot -p mysql> USE vmail; mysql> CREATE TABLE IF NOT EXISTS share_folder ( -> from_user VARCHAR(150) NOT NULL, -> to_user VARCHAR(150) NOT NULL, -> dummy CHAR(1), -> PRIMARY KEY (from_user, to_user) -> ); |
Configure Roundcube Webmail
Roundcube-0.5 supports shared IMAP folder, with one config setting in main.inc.php:
| File: main.inc.php |
// imap's folder delimiter $rcmail_config['imap_delimiter'] = "/"; // Leave below settings as "null". $rcmail_config['imap_ns_personal'] = null; $rcmail_config['imap_ns_other'] = null; $rcmail_config['imap_ns_shared'] = null; |
Test shared folder
Note:
- Please restart dovecot and apache web server after you modified dovecot and roundcube.
- For Roundcube user, there's a plugin available for roundcube-0.5, it's easy to let user manage their mailbox sharing.
- For Thunderbird user, there's a add-on available too.
Test steps:
- Set a share folder with telnet.
| Terminal: |
# telnet localhost 143 * OK [...] Dovecot ready. . login from@domain.ltd passwd # <- Login with your email address and password. . OK [... ACL ..] Logged in . SETACL archive testing@a.cn rl # <- Share folder 'archive' to user testing@a.cn, allow to read (r) and lookup (l). . OK Setacl complete. ^] # <- Ctrl + ] telnet> quit |
- Log into roundcube webmail with account testing@a.cn. And you can now see the shared folder. See screenshot here
- After you shared folder with 'SETACL' command, dovecot will insert a record in MySQL database (table share_folder):
| Terminal: |
# mysql -uroot -p mysql> USE vmail; mysql> SELECT * FROM share_folder; +--------------+--------------+-------+ | from_user | to_user | dummy | +--------------+--------------+-------+ | www@a.cn | testing@a.cn | 1 | +--------------+--------------+-------+ |
References
- BigMichi1's contribution
- Dovecot wiki: Mailbox sharing between users (v1.2+)
- Plugin for Roundcube webmail (0.5+): http://lists.roundcube.net/mail-archive/dev/2011-01/0000012.html
- Imap-ACL-Extension for Thunderbird, manage acls/permissions for shared mailboxes/folders on imap servers.
