Reindex Dovecot Mailbox

Error type (mail.log)

  • FETCH [] for mailbox XXX UID XXXX got too little data: 0 vs 732242
  • Maildir filename has wrong W value XXXX
  • Corrupted index cache file /var/vmail/ Broken virtual size for mail UID XXX

What is this script for

  • Find errors trought mail.log file.
  • Gets the real size of the error file and change the name with the right W value.
  • Rename corrupted file.

Sample Output

[+] File /var/vmail/,W=7322,S=7226:2,b.fake

[+] New count is: 5934

[*] moving file to: /var/vmail/,W=5934,S=7226:2,b.fake

[?] Ready... [press key]

[+] Backup file: /var/vmail/,W=7322,S=7226:2,b.fake.bkp

[+] File moved:

-rw-r--r-- 1 root root 0 Oct 2 15:58 /var/vmail/,W=5934,S=7226:2,b.fake


  • If you see something wrong, please drop me an email: