Symptoms
When trying to remove an email account from the server using the UI or the API you might get the following error message:
uapi --user=cptest Email delete_pop email=test domain=cptest.tld
---
apiversion: 3
func: delete_pop
module: Email
result:
data: ~
errors:
- You do not have an email account named “test@cptest.tld”.
messages: ~
metadata: {}
status: 0
warnings: ~
However, when you check to see if the email account exists, other APIs list the account as existing:
for i in $(awk '{print $2}' /etc/trueuserdomains); do uapi --user=$i Email list_pops 2> /dev/null | egrep "\s+email:" ; done | grep -Ei cptest.tld
email: test@cptest.tld
Description
This usually happens when the mail mailboxes associated with that email account have been removed from the server for whatever reason:
ls -Flathr /home/cptest/mail/cptest.tld/test
ls: cannot access /home/cptest/mail/cptest.tld/test: No such file or directory
If the mailboxes are missing entirely for an account, that puts the account in a very unstable state and none of the API calls are guaranteed to work then.
Workaround
You should be able to get around this issue by first creating a dummy/temporary/empty mailbox like this:
mkdir /home/cptest/mail/cptest.tld/test; chown cptest:cptest /home/cptest/mail/cptest.tld/test; chmod 751 /home/cptest/mail/cptest.tld/test
And then you should be able to remove the email account either from the cPanel interface or by running the following command:
uapi --user=cptest Email delete_pop email=test domain=cptest.tld
Comments
0 comments
Article is closed for comments.