When hMailServer receives a message, information regarding this message is stored in two places. Information on SMTP envelope, receive-time, and message flags are stored in the hMailServer database (tables hm_messages and hm_messagerecipients). The actual message is stored in an .eml file in the hMailServer Data Directory.
In some situations, these two may come out of synch. For example, if a database table becomes corrupt, you may have messages in the Data directory which is not referenced by the database. When this happens, you will not be able to download the messages using your e-mail client. And if the messages have not been delivered, hMailServer won't deliver them.
The solution to this problem is to use the hMailServer Data Directory Synchronizer. The tool is installed with hMailServer and located in the Addons folder.
Data Directory Synchronizer goes through all the message files in the data folder. It searches for files with the extension .hma or .eml. (Older versions of hMailServer used .hma as extension, now .eml is used). When it has located an .eml file, it checks whether this .eml file is referenced by the database, if not, the message is inserted into the database.
If the .eml file exists in a user directory, hMailServer inserts the message into this users account. The message then ends up in the users Inbox folder. The IMAP folder information is stored in the database, and since this info has been lost, hMailServer does not know what folder to store the message in.
If the .eml file exists in the Data root directory, the message is inserted into the delivery queue. hMailServer parses the To and CC headers of the email to determine who the message should be delivered to. To prevent the email from being re-sent to recipients, hMailServer only sends the message to local recipients.