When trying to create a new email account using our UI or the API, you might run into this error: (Using the API here):
uapi --user=cptest Email add_pop email=usernew password=jhfs777h$#@$ domain=cptest.tld skip_update_db=1
- Sorry, you have exceeded the maximum allowed email accounts.
However when checking the MAXPOP value for the user (here "cptest") you can see that the number of the exiting email accounts is less that the MAXPOP value for the user:
grep -Ei maxpop /var/cpanel/users/cptest
Note: The MAXPOP value is basically the same as the "Max Email Accounts" value that you set when creating an account and also available in the WHM >> Account Functions >> Resource Limits >> Max Email Accounts interface. This issue only happens when the number of existing emails accounts for a user is already less than the maximum number of email accounts for that user (MAXPOP), however despite that the above error is still shown.
Furthermore, you can run the following to see the number of existing email account for a given user to compare it with MAXPOP if you wish to: (Here I am using "cptest", so that part needs to be replaced with the user that you wish to check)
uapi --user=myemaily Email list_pops | grep -Ei "^\s*email:" | wc -l
As you can see the number here is 2 and it's definitely less than the MAXPOP which is 5 (Please see above).
It seems that if there are dangling symbolic links in the account mail directory (/home/$USER/mail) of a user, pointing to non-existent mailboxes when the mail directory for a domain (/home/USER/mail/DOMAIN_NAME) is missing , cPanel counts these dangling symbolic links as email accounts and consequently creating new email accounts for that user would fail if the number of these dangling symlinks plus the existing email accounts exceeds the MAXPOP value for that user.
We've opened an internal case for our development team to investigate this further. For reference, the case number is CPANEL-37239. Follow this article to receive an email notification when a solution is published in the product.
At the time there is no workaround for this issue, although it's generally recommended that the dangling symbolic links in user's /home/$USER/mail directory be removed since they are not referring to anything.