cPanel Housekeeping – Clearing Default Email Account (via SSH & cPanel)
In every cPanel account, there is default mail account in the name of the cPanel username. This mail account is not meant for normal emailing purposes. All the notification mails from the server and the mails to the accounts which doesn’t exist goes there if catch-all feature is enabled. In most cases spam mails are being sent to random email accounts under a domain and even if the email address is not present, these spam mails are most likely going to end up in these default mail accounts. This increases the disk space usage and is completely useless. So it is often recommended to clear the mailbox of the default mail accounts. Let us see how this is done.
Clearing mails in default mail acount via SSH
Just login to your cPanel account via SSH if your hosting provider provides SSH access.
ssh -p port cpaneluser@hostname_or_IP
Provide password when prompted. This will let you go into your home directory.
Change the current working directory to the mail directory.
Remove the files in ‘cur‘ and ‘new‘directory which contains all the read and unread mails in the default cPanel account respectively.
rm -rf cur/*
rm -rf new/*
Also remove or rename the file ‘maildirsize’ for manually updating the quota. This file will be created again with updated mail quota.
rm -f maildirsize or,
mv maildirsize maildirsize.bak
Double check the command before deleting just to be on the safe side. Now check if your disk space via cPanel >> Files >> Disk Space Usage, you can see the mails has been cleared and the disk space has been restored. You’ll have to give it some time (15 minutes by default) for the cPanel cache to update and you might need to logout and login again to see the updated quota.
Clearing mails in default mail account via cPanel interface
This is an alternate way to clear the default mail account if you don’t have SSH access. Just login to your cPanel account and open File Manager.
Go to ‘mail’ directory present in your home directory as shown in the screenshot below.
Just select the directories ‘cur‘ and ‘new‘ and click on delete button. These directories will be recreated by cPanel once you delete it.
If you are a Dedicated server user, you can disable the catch-all feature by going to WHM >> Server Configuration >> Tweak Settings >> Mail and set the value of the field Initial default/catch-all forwarder destination to fail
With this setting being enabled, no spam mails will go to the default cPanel mail account if the intended mail account doesn’t exist.
If you need assistance, no problem, just contact our 24/7 support department and they will get is sorted in a flash.