iredmail-doc/zh_CN/howto/mailbox.sharing.md

98 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

2015-08-19 08:11:02 -05:00
# 共享邮箱(将 IMAP 目录共享给其他用户)
2015-08-17 07:27:17 -05:00
2016-06-16 08:47:48 -05:00
!!! note
2015-08-17 07:27:17 -05:00
2016-06-16 08:47:48 -05:00
* 自 iRedMail-`0.9.0`版起,共享邮箱功能默认开启,用户不需要任何额外的配置。
* 自 iRedMail-`0.7.0` 版起Dovecot 已包含共享邮箱的相关设置,但没有启用。
只需要按照以下文档中启用 `acl` 插件的步骤即可启用该功能。
2015-08-19 08:11:02 -05:00
2016-06-16 08:47:48 -05:00
* 请勿混淆`共享邮箱`和`公共邮箱`。用户在共享邮箱时必须选择要共享的目录并
指定共享给谁。
2015-08-17 07:27:17 -05:00
2015-08-19 08:11:02 -05:00
## 共享邮箱
2015-08-17 07:27:17 -05:00
2015-08-19 08:11:02 -05:00
要开启邮箱共享功能,请确保 `acl` 插件已在Dovecot 的配置文件
`/etc/dovecot/dovecot.conf` 里启用。以下是配置示例:
2015-08-17 07:27:17 -05:00
* Dovecot-1.2 版:
2015-08-19 08:11:02 -05:00
2015-08-17 07:27:17 -05:00
```
# Part of file: /etc/dovecot/dovecot.conf
protocol lda {
mail_plugins = ... acl
}
protocol imap {
mail_plugins = ... acl imap_acl
}
```
* Dovecot-2.x 版:
2015-08-19 08:11:02 -05:00
2015-08-17 07:27:17 -05:00
```
# Part of file: /etc/dovecot/dovecot.conf
mail_plugins = ... acl
protocol imap {
mail_plugins = ... imap_acl
}
```
修改后需重启 Dovecot 服务,以使配置生效。
## 测试共享目录
2015-08-19 08:11:02 -05:00
示例:将用户 `from@domain.ltd``Sent` 目录共享给用户 `testing@domain.ltd`
2015-08-17 07:27:17 -05:00
2015-08-19 08:11:02 -05:00
> 注意:不要遗漏 IMAP 命令前面的点 `.` 号。
2015-08-17 07:27:17 -05:00
```
2015-08-19 08:11:02 -05:00
# telnet localhost 143 # <- 输入此命令
2015-08-17 07:27:17 -05:00
* OK [...] Dovecot ready.
2015-08-19 08:11:02 -05:00
. login from@domain.ltd passwd # <- 输入此命令
# 使用完整邮件地址和密码登陆
2015-08-17 07:27:17 -05:00
. OK [... ACL ..] Logged in
2015-08-19 08:11:02 -05:00
. SETACL Sent testing@domain.ltd rli # <- 输入此命令
# 将 Sent 目录共享给 testing@domain.ltd
# 具体权限为:读(r, read),查询(l, lookup),插入新邮件(i, insert)。
2015-08-17 07:27:17 -05:00
. OK Setacl complete.
2015-08-19 08:11:02 -05:00
^] # <- `Ctrl + ]` 组合键退出 telnet 程序
2015-08-17 07:27:17 -05:00
telnet> quit
```
2015-08-19 08:11:02 -05:00
以用户 `testing@domain.ltd` 身份登录 Roundcube 或 SOGo webmail即可看到共享的目录。
2015-08-17 07:27:17 -05:00
额外信息:
* 使用 `SETACL` 命令共享目录后, Dovecot 会在 MySQL 数据库中插入一条记录。
2015-08-19 08:11:02 -05:00
* 对于采用 OpenLDAP 后端的用户,此记录保存在 SQL 表 `iredadmin.share_folder` 中。
2015-08-17 07:27:17 -05:00
* 对于采用 MySQL/MariaDB/PostgreSQL 后端的用户,此记录保存在 `vmail.share_folder` 中。
```
# mysql -uroot -p
mysql> USE vmail;
mysql> SELECT * FROM share_folder;
+-----------------+--------------------+-------+
| from_user | to_user | dummy |
+-----------------+--------------------+-------+
| from@domain.ltd | testing@domain.ltd | 1 |
+-----------------+--------------------+-------+
```
## 参考资料
2015-08-19 08:11:02 -05:00
* Dovecot wiki
2015-08-17 07:27:17 -05:00
2015-08-19 08:11:02 -05:00
* [共享邮箱 (v2.0+)](http://wiki2.dovecot.org/SharedMailboxes/Shared)
* [共享邮箱 (v1.2+)](http://wiki.dovecot.org/SharedMailboxes/Shared)
2015-08-17 07:27:17 -05:00
* Roundcubemail 有官方插件 `acl` 用来管理邮箱共享。
* SOGo 邮箱组件默认支持邮箱共享:右击 IMAP 文件夹,选择 `Sharing`
2015-08-19 08:11:02 -05:00
* Thunderbird 客户端可以使用 [Imap-ACL-Extension 插件](https://addons.mozilla.org/en-US/thunderbird/addon/imap-acl-extension/)管理共享邮箱