Each domain in cPanel has a default mail account configured with the account username. This mail account is used for all the notifications from the server. Also, if the catch-all feature is enabled, all non-existing emails are routed to it.
Spam is often sent to randomly generated or common mailboxes (eg. [email protected]) and if they are are not configured under your cPanel it will end up in the default mailbox. This will eventually take up a lot of disk space and there may be the need to clear this space to avoid the account filling up.
Default Mailbox Locations
There are two directories that need to be cleared under the default mail account. These are the
new directories located in the following locations
Clearing these directories will free up disk space on the default mailboxes.
Clear Mails with SSH in the Terminal
Run the following commands in the terminal to delete all recurring mail items in the default mailboxes
$ rm -rf /home/username/mail/cur/* $ rm -rf /home/username/mail/new/*
The above command stipulates the following:
rmis the command to remove/delete items.
-rfor recursive removal (typically used with directories)
-fto force the action
-rfis to simply join the two options joined together.
Note: Always check your commands before running in a terminal
It is important to note that the disk quota will not actually change after removing the mails from the
new directories as cPanel caches these values. There is
maildirsize file that needs to be deleted or renamed but will automatically be generated again with the correct values.
To delete the file run the following command:
$ rm -rf /home/username/mail/maildirsize
To rename the file run the following command
$ mv /home/username/mail/maildirsize /home/username/mail/maildirsize.old
Clear Mails with File Manager
The above operations can also be done with cPanel’s File Manager. Navigate to the above locations to delete the files in the
new directories, and to delete or rename the
Disable Catch-All Feature in WHM
The server administrator will be able to disable the Catch-All Feature in WHM by doing the following:
- Navigate to WHM > Server Configuration > Tweak Settings > Mail
- Set the value of the field ‘Initial default/catch-all forwarder destination’ to fail
Check the Disk Space
Check the disk space usage to see if the mails has been removed. To see disk usage, navigate to cPanel > Disk Usage