On cPanel emails are stored by default in Maildir format where each email is stored as a separate file in the /home/user/mail/domain/email//cur directory. On older systems and even cPanel in the past used Mbox format as the default where many emails are stored in the same file on the server. Even today, some servers still use it and the following error happened when trying to move/delete email that are stored in a corrupt mbox file:
the following errors are logged in the maillog
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Warning: fscking index file /home/XXXXXX/mail/XXXX.com/desk/storage/dovecot.map.index
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Warning: mdbox /home/XXXXXX/mail/XXXX.com/desk/storage: rebuilding indexes
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: Corrupted dbox file /home/XXXXXX/mail/XXXX.com/desk/storage/m.555 (around offset=0): EOF while reading file header
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.555
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: Corrupted dbox file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921 (around offset=54): Invalid dbox version
Mar 12 09:29:52 s8 dovecot: imap(email@XXXX.com)<122323><umFMQAHan35/AAAB>: Error: mdbox rebuild: Failed to fix file /home/XXXXXX/mail/XXXX.com/desk/storage/m.921
If we enter the directory where emails are stored: /home/user/domain/email/ we can see that the cur & new folders used by maildir format are empty, and that emails are stored in storage folder typical for mbox format. We can also notice the corrupted (broken) mbox files.
To fix this issue caused by corrupted mbox files, we can convert the format for this cPanel user from mdbox to maildir. navigate to WHM > Mailbox Conversion select convert to maildir
Choose the account and click on Next
on the next screen just confirm the selection:
After all emails are transferred from mbox format to maildir, you can delete storage and mailboxes folders from that account to free disk space. Email move/delete now should work as usual.
To check if any other accounts on the server still use mbox format you can simply search for the storage folders:
find /home/*/mail/* -iname 'storage*'