Skip to content

Commit 8b86b7e

Browse files
cmousesirainen
authored andcommitted
imap_metadata: Document how to use non-file based storage
Document how to use SQL and Redis for storing IMAP metadata. Thanks for Joseph D Wagner for testing the SQL part.
1 parent 6450979 commit 8b86b7e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

source/configuration_manual/imap_metadata.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,50 @@ Example:
2525
protocol imap {
2626
imap_metadata = yes
2727
}
28+
29+
Storing metadata in SQL dictionary
30+
==================================
31+
32+
You can store metadata into a database too. This works best with dedicated
33+
table for storing the entries.
34+
35+
Database schema
36+
---------------
37+
38+
Since username is a primary key, it is required to have some value. When empty,
39+
it means that the value applies to keys with ``shared/`` prefix. Keys
40+
with ``priv/`` prefix are expected to have a non-empty username.
41+
42+
.. code:: sql
43+
44+
CREATE TABLE metadata (
45+
username VARCHAR(255) NOT NULL DEFAULT '',
46+
attr_name VARCHAR(255) NOT NULL,
47+
attr_value VARCHAR(65535),
48+
PRIMARY KEY(username, attr_name)
49+
);
50+
51+
Configuration
52+
-------------
53+
54+
Create dictionary config file with following map::
55+
56+
## driver specific config excluded
57+
58+
map {
59+
pattern = $key
60+
table = attr_priv
61+
fields {
62+
attr_name = $key
63+
}
64+
username_field = username
65+
value_field = attr_value
66+
}
67+
68+
Then in dovecot add::
69+
70+
dict {
71+
metadata = driver:/path/to/config
72+
}
73+
74+
mail_attribute_dict = proxy::metadata

0 commit comments

Comments
 (0)