Delivery error: "stat=Deferred: 451 4.2.0 Mailbox has an invalid format"
After a particularly violent power outage (a suprise shutdown), we started getting error messages on our imap server like this:
Apr 5 21:26:52 jupiter sm-mta[778]: j360A1Yf025619: to=<username@examplecustomerdomain.com>, delay=01:16:51, xdelay=00:00:00, mailer=cyrusv2, pri=1801833, relay=localhost [[UNIX: /opt/cyrus/imap/socket/lmtp]], dsn=4.2.0, stat=Deferred: 451 4.2.0 Mailbox has an invalid format
Undelivered mail goes and lurks in the queue, where attempts to deliver it happen occasionally. Presumably it will eventually time out and bounce.
In our case, the problem turned out to be corrupted quota files (not mailbox files). The solution:
- find the quota files -- in a virtual domain setup, use something like
# find ~cyrus -type f | grep quota
- remove the quota files for the affected mailbox(es)
- run
# reconstruct -r -f user/username@examplecustomerdomain.com
- reapply any required quotas
Now you can force sendmail to flush the queue, and the messages should get delivered.
Note that if sendmail tries to deliver a message after the quota file is deleted but before the reconstruct runs, you get an I/O error instead, and the message gets returned to the queue.