Useful commands when working with large WHM/cPanel mailboxes

This morning our system alerted us about memory usage on one specific user’s email account. The WHM summary email that came through was rather detailed, and contained a number of really useful commands when working with a WHM mailbox. Here is a summary of those commands (copied mostly verbatim):

Remove old junk email

To remove all email older than one year from this account’s Junk folder via the command line, use the following command:

whmapi1 expunge_mailbox_messages account=[email protected] mailbox=INBOX.Junk query='savedbefore 52w'

Remove old email

whmapi1 expunge_mailbox_messages account=[email protected] mailbox=INBOX query='savedbefore 52w'

Obtain Usage Summary of User’s Mailbox

whmapi1 get_mailbox_status account=[email protected]

Increase IMAP Memory Limit

The default IMAP memory limit appears to be 512 MB. During certain period, for example when doing a backup, some of this memory might be depleted. To increase the memory to a new value (ensure you have enough RAM), do this:

whmapi1 set_service_config_key service=dovecot key=mail_process_size value=1024

Reference

Email message titled:

The “imap” service reached its memory limit while it accessed mail for the account

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top