Zimbra CLI Commands: Mailbox Management

Using CLI, you can manage mailboxes in Zimbra with different command options. In this article we are going to start with an overview of zmprov commands. Then we will take a brief introduction to zmmailbox.

ZMPROV COMMANDS

As mentioned above, we are going to start with some zmprov CLI commands to manage a mailbox. For every command, we will show you the extendend and short form and the syntax to be used. Remember that all commands are intended to be executed logging in as Zimbra user, with the command: su - zimbra

Get Mailbox Info:

To get Mailbox info you need to use getMailboxInfo (gmi) with the following syntax:

zmprov getMailboxInfo {accountName}

Normally the above command is used for advanced task or checks.

Get Quota Usage:

To get quota usage you need to use getQuotaUsage (gqu) with the following syntax:

zmprov getQuotaUsage {serverame}

The command above is used to see quota used by accounts on a server. It can be used also for reports.

Re-Index Mailbox:

To re-index Mailbox you need to use reIndexMailbox (rim) with the following syntax:

zmprov reIndexMailbox {user@yourdomain|id} {start|status|cancel} [{types|ids} {type or id} [,type or id...]]

This command is widely used, specially after account migration from old Zimbra versions, or when there are errors in a log or users reports that search is not working.

Recalculate Mailbox Counts:

To recalculate Mailbox Counts you need to use RecalculateMailboxCounts (rmc) with the following syntax:

zmprov RecalculateMailboxCounts {user@yourdomain|id}

You can use this command to istantly recalculate the mailbox quota usage and unread messages count, in case that both are out of sync with mailbox data.

We suggest to schedule “Recalculating mailbox quota usage and message count” to run in off peak hours and use it on one mailbox at a time.

Select Mailbox:

To select Mailbox you need to use selectMailbox (sm) with the following syntax:

zmprov selectMailbox {accountName} [{zmmailbox commands}]

Below you can find some other commands used mainly in situations where you are experiencing problems on the mailbox:

Compact Index Mailbox:

To compact Mailbox Index you need to use compactIndexMailbox (cim) with the following syntax:

zmprov compactIndexMailbox {name@domain|id} {start|status}

Verify Index:

To verify Index you need to use verifyIndex (vi) with the following syntax:

zmprov verifyIndex {name@domain|id}

Get Index Stats:

To get Index stats you need to use getIndexStats (gis) with the following syntax:

zmprov getIndexStats {name@domain|id}

ZMMAILBOX

To manage mailbox, a tool which can be used to help administrators provision new mailboxes along with accounts, debug issues with a mailbox, and help with migration, is zmmailbox. The basic syntax for this command is:

zmmailbox [args] [cmd] [cmd-args...]

Below we have a table showing you the basic arguments you can use with zmmailbox command with a short description:

Short form nameLong form nameDescription
-h–helpdisplay usage
-f–fileuse file as input stream
-u–urlhttp[s]://{host}[:{port}] server hostname and optional port. Must use admin port with -z/-a
-a–account {name}account name to auth as
-z–zadminuse zimbra admin name/password from localconfig for admin/password
-m–mailboxmailbox to open
-p–password {pass}password for admin account and/or mailbox
-P–passfile {file}read password from file
-v–verboseverbose mode (dumps full exception stack trace)
-d–debugdebug mode (dumps SOAP messages)

In addition to that, there are also some specific CLI tools available for different components of a mailbox. Their usage is described in the CLI help as follows:

  • zmmailbox help admin – Help on admin related commands
  • zmmailbox help commands– Help on all commands
  • zmmailbox help contact– Help on address book. (contact related commands)
  • zmmailbox help conversation– Help on commands related to conversation
  • zmmailbox help folder– Help on folder related commands
  • zmmailbox help item– Help on item related commands
  • zmmailbox help message– Help on commands related to messages
  • zmmailbox help misc– Help on miscellaneous commands
  • zmmailbox help search– Help on commands related to search
  • zmmailbox help tag– Help on tag related commands

Technical writer at Zextras. Linux and technology enthusiast. He describes himself as an atypical and polyhedric IT expert, thanks to a creative and open minded attitude, and to the experience gained over time as an IT technician, system engineer and developer.

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Mail Backup: An important practice
Disaster Recovery Scenario