In every cPanel server, we can find a default mail account in the name of cPanel username. The default mail account is not used for normal mailing purposes. All the notification mails from the server are forwarded to this default mail account. cPanel also routes mails sent to the non-existing email accounts at your domain name to the default mail account if catch-all feature is enabled.
For example, if your default mail account is vasco@demoserver.com and someone emails a non-existent or mistakenly entered address, billy@demoserver.com, then cPanel forwards the email to vasco@demoserver.com. In most cases spam mails are sent to randomly generated email accounts which may or may not exists under a domain. cPanel routes these mails to the default mail account. This increases the disk space usage and is often recommended to clear the mailbox of the default mail accounts.
Default Mailbox Locations
There are two directories that need to be cleared under the default mail account. These are the cur and new directories located in the following locations
/home/username/mail/cur
/home/username/mail/new
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:
- rm is the command to remove/delete items.
- -r for recursive removal (typically used with directories)
- -f to force the action
- -rf is to simply join the two options joined together.
Note: Always check your commands before running in a terminal
Disk Quota
It is important to note that the disk quota will not actually change after removing the mails from the cur and 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
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