Skip to content

IMAP

Cyrus IMAP holds all email and calendar/contacts data, and serves it via IMAP and CalDAV/CardDAV.

Note

Most commands here are native cyrus-imap utilities. Refer to the upstream documentation for more information.

Finding a mailbox on disk

Cyrus uses uuid's for folders, so mailbox paths have to be translated to the path on disk:

Note

Empty folders don't exist on disk (see example below).

Note

mbpath expects a folder name in the format from cyradm, but beware of character escaping (see example below, &- -> &).

$ kolabctl imap cyradm lm user/test*@kolab.org
user/test/#sieve@kolab.org (\HasNoChildren)
user/test/Calendar@kolab.org (\HasNoChildren)
user/test/Configuration@kolab.org (\HasNoChildren)
user/test/Contacts@kolab.org (\HasNoChildren)
user/test/Drafts@kolab.org (\HasNoChildren)
user/test/Files@kolab.org (\HasNoChildren)
user/test/Freebusy@kolab.org (\HasNoChildren)
user/test/INBOX/&- Foobar Test@kolab.org (\HasNoChildren)
user/test/Journal@kolab.org (\HasNoChildren)
user/test/Notes@kolab.org (\HasNoChildren)
user/test/Sent@kolab.org (\HasNoChildren)
user/test/Spam@kolab.org (\HasNoChildren)
user/test/Tasks@kolab.org (\HasNoChildren)
user/test/Trash@kolab.org (\HasNoChildren)
user/test@kolab.org (\HasNoChildren)
$ kolabctl imap mbpath "user/test/INBOX/& Foobar Test@kolab.org"
/srv/imap/spool/default/uuid/7/f/7f763779-0e85-4840-ba18-ed8c9a2d49a0
$ kolabctl imap ls /srv/imap/spool/default/uuid/7/f/7f763779-0e85-4840-ba18-ed8c9a2d49a0
ls: cannot access '/srv/imap/spool/default/uuid/7/f/7f763779-0e85-4840-ba18-ed8c9a2d49a0': No such file or directory

Undeleting email

Emails are only truly deleted (expunged) after 28 days. In the meantime email can be restored like so:

kolabctl imap unexpunge -adv user/user@example.com

To list emails available to be restored:

kolabctl imap unexpunge -l user/user@example.com

For more information see the upstream documentation.

Expire deleted emails

To irreversibly delete emails from a specific user immediately:

Warning

It is normally better to mark as deleted, and wait on the regular delayed expire, so data can be restored meanwhile. However, it can be useful to actually free up disk space when required.

kolabctl imap cyr_expire -D 1 -X 1 -u "user@example.com"

Undelete a mailbox

Deleted mailboxes are just renamed to the DELETED namespace, so restoring the mailbox is a rename operation:

$ kolabctl imap cyradm
cyradm> listmailbox DELETED/user/john*@example.org
DELETED/user/john/4D88AF31@example.org (HasNoChildren)
DELETED/user/john/Drafts/4D88AF34@example.org (HasNoChildren)
DELETED/user/john/Sent/4D88AF34@example.org (HasNoChildren)
DELETED/user/john/Trash/4D88AF35@example.org (HasNoChildren)
cyradm> renamemailbox DELETED/user/john/4D88AF31@example.org user/john@example.org
cyradm> renamemailbox DELETED/user/john/Drafts/4D88AF34@example.org user/john/Drafts@example.org
cyradm> renamemailbox DELETED/user/john/Sent/4D88AF34@example.org user/john/Sent@example.org
cyradm> renamemailbox DELETED/user/john/Trash/4D88AF35@example.org user/john/Trash@example.org

There is no support for automatically restoring folder hierarchies, so this must be done manually.

Quota report

To get a quota report directly from imap:

kolabctl imap quota

Dump mailboxlist

To dump all available mailboxes in cyrus (primarily for troubleshooting):

kolabctl imap ctl_mboxlist -d

Reindex a mailbox for fulltext searching

To immediately update the fulltext index for a mailbox:

kolabctl imap squatter -v -r user/test1@kolab.org

Inspecting a mailbox

> kolabctl imap mbexamine user/test1@kolab.org | head -n 18

Examining user/test1@kolab.org... Mailbox Header Info:
  Path to mailbox: /var/spool/imap//uuid/c/7/c7cede6b-5760-41dc-8c3a-4686d1082311
  Mailbox ACL: test1@kolab.org     lrswipkxtecdan
  Unique ID: c7cede6b-5760-41dc-8c3a-4686d1082311
  User Flags: [none]

 Index Header Info:
  Generation Number: 0
  Minor Version: 17
  Header Size: 160 bytes  Record Size: 112 bytes
  Number of Messages: 2483  Mailbox Size: 2201072831 bytes  Annotations Size: 14 bytes
  Last Append Date: (1761666951) Tue Oct 28 15:55:51 2025
  UIDValidity: 1761550923  Last UID: 5753
  Deleted: 0  Answered: 2  Flagged: 153
  Mailbox Options: POP3_NEW_UIDL
  Last POP3 Login: (0) Thu Jan  1 00:00:00 1970
  Highest Mod Sequence: 12452

Please note that the above mailbox count does not include messages that are marked as deleted (listed by unexpunge -l).