Code: Select all
v-import-cpanel-backupIn /var/log/dovecot.log you may see something like this:
Code: Select all
Mar 23 15:21:07 imap([email protected])<3347150><yUjivrFNXJt/AAAB>: Error: Mailbox INBOX: UID=1: read(/home/user/mail/domain.com/account/cur/1748433712.M456713P1942205.someserver,S=80724,W=82092:2,S) failed: Cached message size larger than expected (80724 > 19442, box=INBOX, UID=1) (read reason=mail stream)
Mar 23 15:21:07 imap([email protected])<3347150><yUjivrFNXJt/AAAB>: Error: Mailbox INBOX: Deleting corrupted cache record uid=1: UID 1: Broken physical size in mailbox INBOX: read(/home/user/mail/domain.com/account/cur/1748433712.M456713P1942205.someserver,S=80724,W=82092:2,S) failed: Cached message size larger than expected (80724 > 19442, box=INBOX, UID=1)
Mar 23 15:21:07 imap([email protected])<3347150><yUjivrFNXJt/AAAB>: Error: Mailbox INBOX: UID=1: read(/home/user/mail/domain.com/account/cur/1748433712.M456713P1942205.someserver,S=80724,W=82092:2,S) failed: Cached message size larger than expected (80724 > 19442, box=INBOX, UID=1)
Mar 23 15:21:07 imap([email protected])<3347150><yUjivrFNXJt/AAAB>: Info: FETCH failed: Internal error occurred. Refer to server log for more information. [2026-03-23 15:21:07] in=337 out=1273 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0Important:
- Run this only after confirming that imported mail files are actually gzip-compressed.
- Make sure to replace with the correct mail path for the affected account.
Code: Select all
/home/user/mail/ - It is strongly recommended to create a backup before making any changes.
Code: Select all
cd /home/user/mail/
Code: Select all
find ./ -type f -exec sh -c '
for f; do
if file "$f" | grep -q "gzip compressed data"; then
tmp=$(mktemp) || exit 1
if gunzip -c "$f" > "$tmp"; then
touch -r "$f" "$tmp" && mv "$tmp" "$f"
else
rm -f "$tmp"
fi
fi
done
' sh {} +
- scans all files under the selected mail directory
- checks whether a file is gzip-compressed
- decompresses the file into a temporary file
- preserves the original timestamp
- replaces the original compressed file with the decompressed version
Code: Select all
find \( -name "dovecot.index" -or -name "dovecot.index.cache" -or -name "dovecot.index.log" -or -name "dovecot.index.log.2" -or -name "dovecot.mailbox.log" -or -name "dovecot.index.log.newlock" \) -delete
Dovecot may still keep old mailbox index information. Deleting these index files forces Dovecot to rebuild them based on the now-correct message files.
Step 4, restart Dovecot
Code: Select all
systemctl restart dovecot
After this procedure, the imported Maildir messages should be readable normally, and the mailbox indexes should be rebuilt correctly.
