cPanel reporting incorrect /mail/ directory size

Many times, cPanel is reporting an incorrect value in cPanel->Disk Usage interface. In our test case the value from the shell is 308MB:

root@web [/home/mmtest]# du -sh mail
308M    mail
root@web [/home/mmtest]#

But the value reported in cPanel is 462.99MB as shown in the image below:

mail directory size 1

This is caused by the dovecot server not updating correctly the disk usage. to fix this situation, run the commands:

# /scripts/generate_maildirsize –confirm –allaccounts –verbose $username

root@web [/home/mmtest]# /scripts/generate_maildirsize --confirm --allaccounts --verbose mmtest
Rebuilding the maildirsize files for: mmtest
Rebuilding the maildirsize files for:
Checking user mmtest
Calculating diskusage and diskcount from reading files
Writing /home/mmtest/mail/maildirsize for user merches
Checking user
Calculating diskusage and diskcount from reading files
Writing /home/mmtest/mail/ for user john
root@web [/home/mmtest]#

Now the disk usage is reported correctly in cPanel:

mail directory size 2

To run the command for all the accounts use
# /scripts/generate_maildirsize –confirm –allaccounts –verbose

More information on this cPanel script can be found by running
# /scripts/generate_maildirsize –help

How to add DKIM and SPF records for your domain from cPanel

DKIM and SPF are two mechanism that allow you to prevent SPAM email messages. Also, they will improve your email delivery rates. You can easily enable them in cPanel.

DKIM is a means of verifying incoming email. It ensures that incoming messages are unmodified and are from the sender from whom they claim to be. This feature works to prevent incoming spam messages.


The SPF system allows you to specify servers and IP addresses that are authorized to send mail from your domain(s). This feature works to prevent outgoing spam messages.



To enable DKIM and/or SPF in cPanel:

  1. Go to and log in
  2. Navigate to EMAIL section, look for Authentication option
  3. On the DKIM section click the Enable button. You will see a confirmation: DKIM has been enabled.
    The DKIM record will look like:

    default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtNG7H+7jKR5uZT/RD7nGbVQk9Pv7PrP279MQ7rEAhq0CRUiXTBh7LSfkeLoEHwjSiFrs0hVXR4sDD7iiDn08BTNfSvH2GaS0Vnz83qeJAAf3nkB1KjrIwqYOD1+Wl+GtDdzCx6/1OFcckRQsN8I3N+hH41sbf5ouVf3O9IANvSpzq6IWWvDqpmncIwebJkt8r" agdAyTNRjpcNHJjlIc9pAMnNz1lMoaaf61kRt3quxkdbnYwVxtvprkWdbyjMJ+zJ7lpwOCBYBAW9HVoM3S5/vUWUA0RB6o3V96qs4edRh7spuMi/aLvygKs7Agsbz5LPajybl5gqqhUYumUnyMOcwIDAQAB\;
  4. Click the Go Back button
  5. On the SPF section click the Enable button. You will see a confirmation like: SPF has been enabled. Your raw SPF record is: v=spf1 +a +mx +ip4: ~all
  6. Click the Go Back button
  7.  You can also change other advanced settings. Modify them only as you know what are you doing. Otherwise, don’t modify these settings or ask your host about them.
  8. This is all. You have configured DKIM and SPF for your domain.

You can check the DNS entries which has been added in cPanel->DOMAINS section->Zone Editor.

The video tutorial for this knowledge base post:

Related KB post:
Add a DMARC record to your domain in cPanel

How to configure email encryption in Horde Groupware

In this post we will show how to configure Horde Groupware to use email encryption.
Horde Groupware is a free webmail program which you can access via cPanel at:

We will assume that you already generated your key pair in cPanel->Encryption. Look at this KB post: Create public and private GnuPG keys for email encryption in cPanel

  1. Login with your credentials at and select the Horde option.

horde groupware 1

2. From the Horde menu go to  Preferences->Mail

horde groupware 2

3. Then choose PGP

horde groupware 3

4. On the PGP page, check the Enable PGP functionality? option and click Save.

horde groupware 4

5. Now on the Horde PGP page you will see more options.

  • Use the Import Public Key button to import public keys. A new entry will be created in the Address Book – entry that will contain the public key of that email.
  • Use the Import Key button to import your private key. It will be used to encrypt messages that you send.

horde groupware 5

Do not give your private key to anyone! Send only your public key.

6. When sending messages you can select if you want to encrypt or not the message. Don’t forget that only recipients that have your public key will be able to read the messages you choose to encrypt.

horde groupware 6

A public/private key looks like:

Version: GnuPG v2.0.22 (GNU/Linux)


Related KB: Create public and private GnuPG keys for email encryption in cPanel

Create public and private GnuPG keys for email encryption in cPanel

To use email encryption the first step is to generate your private and public key for your email address. You can generate these keys in cPanel. Your messages will be encrypted with the private key. The recipients will decrypt the messages using your public key.

Do not give your private key to anyone! Give only your public key.

Steps to generate private and public keys for email encryption:

  1. Connect to your cPanel account
  2. Look for Encryption (EMAIL section)
  3. Here enter the details for:
    – Your Name
    – Your Email
    – Comment or Nickname
    – Key Password (you can use the Password Generator)
    – Expiration Date (1y (1 year) 3w (3 weeks) 5d (5 days) 0 (No expiration date))
    – Key Size (2048 or 4096)
  4. Click the Generate Key button. You will see a message at the top of the page saying “Key is being generated. This may take a few minutes.
  5. Wait for a few seconds and you will see “The Key has been successfully created.” 
  6. Refresh the page and you will see the private and public keys.
  7. To view and copy a key click the View link.
cPanel Email Encryption
cPanel Email Encryption
To delete the keys, delete the private key. The public key will be automatically deleted. Notice that you can’t delete the public key. If you try to delete the public key, you will receive an error message: “Sorry, you must delete the secret key before removing the public key.

The short video how-to is here:


Related KB: How to configure email encryption in Horde Groupware

How to set up an IMAP account in Microsoft Outlook for Android

Microsoft Outlook is the most used IMAP mobile email client. You can download it for free from Google Play. Here is the link . Minimal requirements are Android 4.1 and up and about 50MB of free space on your phone/tablet.

Microsoft Outlook Android
Microsoft Outlook Android

We get a lot of questions from users on how to configure their email Android email client. We will show below how to add an email account to Microsoft Outlook for Android. Same settings should work on any IMAP clients.
Steps to add the IMAP account to Outlook:

  1. Download the Microsoft Outlook from the Google Play
  2. Install and open the application
  3. Click the GET STARTED button
  4. Enter your email address and click CONTINUE
  5. On the next screen enter your Password, Display Name (like “John Doe”) and Description (like “work”)
  6. Click the Accept Icon ✔ from the top-right side. 
POP3 and IMAP are two different internet protocols used to access email accounts.
If you have difficulties configuring your mobile email client(default email client, Outlook, Gmail, Blue Mail etc.) please contact us. We are here to help 24/7.