Sun Java System Messaging Server 6.3 Administration Reference


The mboxutil command lists, creates, deletes, renames, or moves mailboxes (folders). mboxutil can also be used to report quota information, restore expunged messages, and list mailbox subscriptions.

Note –

You should not kill the mboxutil process in the middle of execution. If it is killed with SIGKILL (kill -9), it may potentially require that every server get restarted and a recovery be done.

POSIX regular expressions can be used in the mboxutil command.

Requirements: Must be run locally on the Messaging Server; the stored utility must also be running.

Location: msg-svr-base/sbin

Mailbox Naming Conventions

You must specify mailbox names in the following format:


userid is the user that owns the mailbox and mailbox is the name of the mailbox.

For hosted domains, userid is uid@domain.

For example, the following command creates the mailbox named INBOX for the user whose user ID is crowe. INBOX is the default mailbox for mail delivered to the user crowe.

mboxutil -c user/crowe/INBOX

Important: The name INBOX is reserved for each user’s default mailbox. INBOX is the only folder name that is case-insensitive. All other folder names are case-sensitive.


mboxutil -l [-p MUTF7 IMAP pattern | -P regular expression] [-x | -s]

mboxutil -c {mailbox | -f file}

mboxutil -d {mailbox | -p MUTF7 IMAP pattern | -P regular expression | -f file}

mboxutil -R [-t hours] mailbox

mboxutil -r {oldname newname | -f file } [partition]

mboxutil -e [-p MUTF7 IMAP pattern | -P regular expression ]

mboxutil {-c | -d } [-f file ]

mboxutil -o [-w file ] [-t days] 

mboxutil -S [-n [-f file] | -u -f file]

mboxutil -l [-p MUTF7 IMAP pattern |-P regular expression] [-x] 


The options for this command are:




Obsolete. Used to list all user quota information. Use. imquotacheck

-c mailbox

Creates the specified mailbox. 

A mailbox must exist before creating a secondary mailbox. 

-d mailbox

Deletes the specified mailbox. 

To delete a user from the message store, use the following value for -d mailbox:


For example, to delete the user john from the message store, use -d user/john/INBOX. To delete the mm folder in the user john’s mailbox, use -d user/john/mm.

The recommended method to delete a user is to mark the user status as deleted in the LDAP directory (by using the Delegated Administrator utility commadmin user delete command or the Delegated Administrator console.). Next, remove resources from the user that have been marked as deleted for a period longer than a specified number of days by using the msuserpurge command for all mail services and csclean for all calendar services. Finally, use the commadmin domain purge command to permanently remove the users. .

For more information on removing users, see the following technical note: Deleting Messaging Server, Calendar Server, and Communications Express Users

If you use the Delegated Administrator utility as described in the preceding paragraph, you do not have to use the mboxutil -d command to delete a mailbox.

Note that -p and -P can be used in conjunction with one another.


Expunges all deleted messages in the message store. This option also can be used with the -p pattern or -P regexp options to expunge all deleted mailboxes with names that match pattern or regexp.

-f file

Specifies a file that stores mailbox names. The -f option can be used with the -c, -r, -S, or -d options.

The file contains a list of mailboxes on which the mboxutil command is executed. The following is an example of entries in a data file:



Lists all of the mailboxes on a server. 

mboxutil -l will correctly display characters associated with the system locale under which mboxutil is being executed. The -P regexp option will accept international characters.


Lists personal, non-existing mailbox subscriptions. The -n option is used with the -S option.


Checks for orphaned accounts. This option searches for inboxes in the current messaging server host which do not have corresponding entries in LDAP. For example, the -o option finds inboxes of owners who have been deleted from LDAP or moved to a different server host. For each orphaned account it finds, mboxutil writes the following command to the standard output:

mboxutil-d user/userid/INBOX unless -w is specified

-p pattern

When used with the -l option, lists only those mailboxes with names that match pattern.

Can also be used with the -d or -e option to delete or expunge mailboxes with names that match pattern.

You can use IMAP wildcards. This option expects a pattern in IMAP M-UTF-7 format. This is not the recommended way to search for non ascii mailboxes. To search for non ascii mailboxes, use the -P option. 

-P regexp

Lists, deletes, or expunges only those mailboxes with names that match the specified POSIX regular expression. This option expects the regexp in the local character encoding.

-q domain

Obsolete. Use imquotacheck -d domain

-r oldname newname [partition]

Renames the mailbox from oldname to newname. To move a folder from one partition to another, specify the new partition with the partition option.

This option can be used to rename a user. For example, mboxutil -r user/user1/INBOX user/user2/INBOX moves all mail and mailboxes from user1 to user2, and new messages will appear in the new INBOX. (If user2 already exists, this operation will fail.)

-R mailbox

Restores deleted messages that have not yet been purged. 

When a mailbox is expunged or expired, the uids of the deleted messages are stored in a store.exp file. The messages are physically removed by imexpire after the cleanup age has passed. When expunge or expire is issued by mistake, this option can be used to restore the deleted messages that have not been purged by imexpire into the original mailbox.


When used with the -l option, displays only the mailbox name. No other data is displayed.


Lists personal mailbox subscriptions. When used with the -n option, the -S option lists or unsubscribes non-existing mailbox subscriptions.

-t days

| hours

When used with the -o option, lists the mailboxes that have not been accessed in a specified number of days (days).

When used with the -R option, restores messages that were expunged in the last specified number of hours (hours). If the -R option is used without the -t option, all messages that were expunged or expired are restored, regardless of their age.

Thus, the -t option identifies inactive mailboxes (based on last-accessed date) together with orphaned mailboxes (mailboxes that do not have corresponding user entries in the LDAP directory).

To identify (list) the orphaned and inactive mailboxes, use mboxutil -o -w file -t num.

To mark these orphaned and inactive mailboxes for deletion, use mboxutil -d -f file, where file is the same file as the one passed to -w in the preceding command.

To use this feature, the config variable local.enablelastaccess must be enabled for at least the number of days specified with the -t option.


Unsubscribe personal non-existing mailbox subscriptions listed in the file specified with the -f file option.

-w file

Used with the -o option. Writes to a file the mailbox names generated by the -o option (which identifies orphaned accounts).


When used with the -l option, displays the path and access control for a mailbox.


To list all mailboxes for all users:

mboxutil -l

To list all mailboxes and also include path and acl information:

mboxutil -l -x

To list all mailboxes displaying only the mailbox names:

mboxutil -l -s

To create the default mailbox named INBOX for the user daphne:

mboxutil -c user/daphne/INBOX

To delete a mail folder named projx for the user delilah:

mboxutil -d user/delilah/projx

To delete the default mailbox named INBOX and all mail folders for the user druscilla:

mboxutil -d user/druscilla/INBOX

To rename Desdemona’s mail folder from memos to memos-april:

mboxutil -r user/desdemona/memos user/desdemona/memos-april

To restore messages that were expunged from Desdemona’s memos mail folder in the last 24 hours:

mboxutil -R -t 24 user/desdemona/memos 

To move the mail account for the user dimitria to a new partition:

mboxutil -r user/dimitria/INBOX user/dimitria/INBOX partition

where partition specifies the name of the new partition.

To move the mail folder named personal for the user dimitria to a new partition:

mboxutil -r user/dimitria/personal user/dimitria/personal \

To list orphaned mailboxes and mailboxes that have not been accessed in 60 days:

mboxutil -o -w orphanfile -t 60

The preceding example writes the list of orphaned and inactive mailboxes to a file named orphanfile.

To delete orphaned and inactive mailboxes:

mboxutil -d -f orphanfile

where orphanfile is a file that has stored a list of orphaned and inactive mailboxes identified with the -o option.

To list personal, non-existing mailbox subscriptions for user mailboxes listed in a file named orphanfile:

mboxutil -S -n -f orphanfile

To unsubscribe the non-existing mailbox subscription list generated by the previous example:

mboxutil -S -u -f orphanfile