Emails are not being displayed in the email client
Symptoms
Messages are not displayed in your email client, for example, in the web interface of Roundcube, a number is displayed for the unread emails in the "Inbox" folder, but when you go to the folder, there are no emails in it.
Besides, the system log /var/log/maillog
(for Debian and Ubuntu, /var/log/mail.log
) has a format error:
isp3 dovecot[1584344]: imap(<mail_box>@<mail_domain.com>)<1584639><eEVEikEWCqh/AAAB>:
Disconnected: FETCH failed: Mailbox INBOX: UID=63:
read(/var/www/<user>/data/email/<mail_domain>/<mail_box>/.maildir/cur/<filename>) failed:
Cached message size larger than expected (7837 > 0, box=INBOX, UID=63)
in=297 out=36931 deleted=0 expunged=0 trashed=0 hdr_count=62 hdr_bytes=21238 body_count=0 body_bytes=0
Causes
The mailbox cache file was corrupted by a corrupted file in the mail directory.
Solution
Move the corrupted file specified in the error and the Dovecot mail server cache files to another directory.
To move the files, use the mv
command to move them to any other non-critical system directory, such as /tmp
, /home
or elsewhere.
An example command for moving mail files:
mv /var/www/<user>/data/email/<mail_domain>/<mail_box>/.maildir/cur/<filename> /tmp/
An example command for Dovecot cache file migration:
mv /var/www/<user>/data/email/<mail_domain>/<mail_box>/.maildir/dovecot* /tmp/
After the files have been migrated, restart the Dovecot service:
systemctl restart dovecot
If after that the e-mails are still not displayed and the log shows the same or a similar error, repeat the steps above for the file now specified in the error.