mail_location setting in dovecot.conf is used if nothing else overrides it.
(User Databases(SQL) <overrides namespaces)
Default: ~/Maildir
mail_location = mailbox-format : path [ : key = value … ]
key:
INDEX : specifies the location of index files.
(disable the index files completely by appending :INDEX=MEMORY. )
SUBSCRIPTIONS : specifies the file used for storing subscriptions.(subscriptions)
DIRNAME : specifies the directory name used for mailbox directories(dbox-Mails/)
userdb
If you're using a single UID and GID for all users, you can set them in dovecot.conf with:
(static userdb)
userdb { driver = static args = uid=500 gid=500 home=/home/%u }
or
mail_uid = vmail mail_gid = vmail
dovecot-sql.conf file:
CREATE TABLE users ( userid VARCHAR(128) NOT NULL, domain VARCHAR(128) NOT NULL, password VARCHAR(64) NOT NULL, home VARCHAR(255) NOT NULL, uid INTEGER NOT NULL, gid INTEGER NOT NULL );
conf
driver = sqlite connect = /path/to/sqlite.db password_query = SELECT userid AS username, domain, password \ FROM users WHERE userid = '%n' AND domain = '%d' user_query = SELECT home, uid, gid FROM users WHERE userid = '%n' AND domain = '%d' # For using doveadm -A: iterate_query = SELECT userid AS username, domain FROM users
dbox
dbox is Dovecot's own high-performance mailbox format.
reasons for dbox's high performance
it uses Dovecot's index files as the storage for message flags and keywords,
so the indexes don't have to be "synchronized" (Index files actually contain significant data)
This data cannot be automatically recreated, so it is important that Index files are treated with the same care as message data files.
一共有兩種 dbox
- single-dbox (sdbox in mail location): One message per file, similar to Maildir.
- multi-dbox (mdbox in mail location): Multiple messages per file
* Unlike Maildir, with dbox the message file names don't change.
Config
# mail_location = maildir:~/Maildir # Maildir mail_location = sdbox:~/sdbox # single-dbox
maildir -> dbox migration
Set
mail_location=sdbox:~/sdbox
and run
dsync -u username mirror maildir:~/Maildir
dsync
SYNOPSIS
dsync [options] mirror location2
dsync [options] backup location2
mirror
Does a two-way synchronization between two mail locations. Changes in
both locations are synchronized to the other one, without losing any
changes made by either of them. Any potential UID conflicts are
resolved by giving them new UIDs.
backup
Backup mails from default mail location to location2 (or vice versa, if
-R parameter is given). No changes are ever done to the source
location. Any changes done in destination are discarded.
Two-way synchronization of mailboxes in different servers (via ssh)
(dsync will merge the changes without losing any changes done on either side.)
(Dovecot's index logs that keep track of changes.)
好處:
creating backups of mails to a remote server
dsync can be run completely standalone.
opts:
-u parameter to do a userdb lookup from auth process.
-v Makes dsync more verbose.
-R Reverse backup direction, so mails in location2 are backed up to default mail location.
i.e.
dsync -u username mirror ssh -i id_dsa.dovecot [email protected] dsync -u username