+91 88 00 563434 [email protected] Blog open-book Knowledge Base

Find Solutions in Our Knowledge Base

How to Clear Default Mail Account in a cPanel Server

You are here:
Sharing is Caring

Default mail account

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 [email protected] and someone emails a non-existent or mistakenly entered address, [email protected], then cPanel forwards the email to [email protected]. 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.

 Clear mails

The directories responsible for the default mail account disk space usage are ‘new’ and ‘cur’. This directory contains all the read and unread mails in the default mail account. You can find it in location

/home/username/mail/cur

and

/home/username/mail/new

Remove the files in ‘cur’ and ‘new’ to clear the mailbox of default mail account and also to free the disk space. You can use remove command to delete the files in ‘cur’ and ‘new’ directories. Double check the command before deleting the files. Run the below command in your terminal to delete all files in ‘cur’ and ‘new’

$ rm -rf /home/username/mail/cur/*

$ rm -rf /home/username/mail/new/*

The email disk quota in cPanel won’t be changed even after you have removed all the emails from ‘cur’ and ‘new’ directories. This is because the email disk quota is cached in the file maildirsize. You must either remove or rename ‘maildirsize’ file for manually updating quota. The ‘maildirsize’ file will be created again with the updated mail quota.

$ rm -rf /home/username/mail/maildirsize

or

$ mv /home/username/mail/maildirsize  /home/username/mail/maildirsize.old

You can also use cPanel file manager to perform this operation. To delete the ‘cur’ and ‘new’ directories, just select them and click on delete button. This directory will be recreated by cPanel once you have deleted it. To rename ‘maildirsize’ file select it and click on rename button. You can now enter a new name and save the file.

Disable catch-all

You can disable the catch-all feature in WHM to prevent cPanel from forwarding mails to the default mail account.

Go to WHM >> Server Configuration >> Tweak Settings >> Mail

Set the value of the field ‘Initial default/catch-all forwarder destination’ to fail

Check disk space

You may now check the disk space usage to confirm the mails has been removed. To check the disk space usage, go to

cPanel >> Files >> Disk Usage

You can see the mail has been cleared and the disk space has been restored. This will take around 15 minutes for the cPanel cache to update. You might need to logout and login again to see the updated data, if you still don’t see the freed disk space.


Sharing is Caring

Leave a Comment

Table of Contents