Corrupt Mail Folders
Problem reported by Scarab - 3/18/2019 at 2:21 PM
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:

  1. Copy the entire user's folder hierarchy under \Smartermail\Domains\yourdomain.tld\Users\username to another directory (or send to a zip archive).
  2. Delete the user in the domain interface of SmarterMail.
  3. Copy the entire user folder back to \Smartermail\Domains\yourdomain.tld\Users\username
  4. Manually delete all folder-*.changes files at the root of the user folder
  5. 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.
  6. In SM choose MANAGE > [...] > ATTACH USER
  7. 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.

2 Replies

Reply to Thread
Patrick Kraus Replied
We are using build 7016 and experience this problem with 4 users all on the same domain and all using IMAP on apple devices. The devices used a mix of Outlook for apple and the default apple mail application.

Luckily a forced rebuild of the Inbox\ brought the account back online for the users.

Our clients are starting to loose their sense of humor very quickly with all there "glitches" that are occurring for no apparent reason. We had years of perfect mail and over the past 12 months mail has become a real thorn in out side. 
Scarab Replied

I've been working with SmarterTools and they promptly rolled out a Custom Build a day after my post followed with a fix early last week. Although @ half of our user-base is MacOS/Apple iOS IMAP users we haven't seen any further mailbox corruption in the past week since the last Custom Build they rolled out to us. I am assuming that they are planning on rolling out the fix in the next Public Build.

Not entirely sure, but I do think this particular issue was a Mac Mail v10.14.4 issue (along with Mac Mail's regularly re-appearing "CRAM-MD5 Authentication failing for any password that contains a symbol" bug which is still preventing users from accessing GMail and Outlook.com, in addition to SmarterMail, until you switch their Mail settings back to Plaintext Authentication to circumvent the issue).

Reply to Thread