Not sure if it is coincidence or not but ever since upgrading to SM Build 7008 we have had 3 email accounts (all using IMAP in Apple Mail) get mail folders completely corrupted. Their folders cannot be accessed in webmail nor can these folders be synched via IMAP (or EWS) any longer (the SELECT command returns the response "BAD SELECT mailbox does not exist"). Issuing a MANAGE > MANAGE DOMAIN > DOMAIN USERS > [...] > REINDEX doesn't resolve the problem. Attempting to go to MANAGE > [...] > REBUILD FOLDER for any corrupt folder simultaneously gives both a success message ("The folder is being rebuilt. You may continue to work while this process runs in the background.") and an error message ("Failed to add folder to mailbox.") and doesn't fix the corruption.
Through trial and error the steps to remedy the corruption have been as follows:
- Copy the entire user's folder hierarchy under \Smartermail\Domains\yourdomain.tld\Users\username to another directory (or send to a zip archive).
- Delete the user in the domain interface of SmarterMail.
- Copy the entire user folder back to \Smartermail\Domains\yourdomain.tld\Users\username
- Manually delete all folder-*.changes files at the root of the user folder
- Open the folders.json file in a text editor (i.e. Notepad++) and remove all items in the "folders" section with the exception of the "Root" and "Mail Root" folders.
- In SM choose MANAGE > [...] > ATTACH USER
- In SM choose MANAGE > [...] > ATTACH FOLDER, and repeat for all mail folders.
I'm not sure what the contents of the folder-*.changes contain and if they are the cause of the problem, or if the GUID & ID of the folders in the folders.json are getting out of sync somehow, but it definitely isn't the actual contents of the folders themselves, nor is the the IndexV2.
NOTE: The above rebuild process will cause CRAM-MD5 authentication to fail. The end-user will have to remove the IMAP account from Apple Mail and re-add the IMAP account anew.
If anyone else is experiencing the same issue, hopefully these steps will save you some frustration.