Archiving e-mails

From support-works
Revision as of 15:41, 4 June 2015 by Rickyf (talk | contribs) (Created page with "Emails should be archived periodically in order to avoid performance issues caused by a large number of emails in the database. In order to archive emails, the Administrator...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Emails should be archived periodically in order to avoid performance issues caused by a large number of emails in the database.

In order to archive emails, the Administrator can move them (to subfolders) via MySQL. However before proceeding, please ensure that a full server backup is taken.

Solution: Below is the procedure for archiving:


Use Sw_Messagestore; Select * from Shared__MBName_folders;

A list of folders and IDs will now be shown. Make a note of the results.


Moving Emails to Subfolders:

Emails can be moved to subfolders, as it is recommended that the number of emails in each folder/subfolder should not exceed 5000. This can be done using the following SQL query (replace ‘MAILBOX’ with the name of the Shared Mailbox, ‘folderparent’ with the FolderID of the main folder in which the sub folder will be created –if any and ‘folderName’ with an appropriate value):

Insert into Shared__MAILBOX_folders (folderparent, foldername, folderhaschild, folderunreadcount) values ( FolderParent, 'FolderName', 0,0 );

Once done, the administrator needs to obtain the FolderID for the newly created folder by running the following query:

Select folderid from shared__MAILBOX_folders where foldername = 'FolderName';

This will return an integer value. Use this integer in the following statement in place of FOLDERID and replace ORIGFolder with the Value for the existing folder from which items are being moved:

Update shared__MAILBOX_mailbox set MsgFolder = FOLDERID where msgfolder = OrigFolder limit 5000;

This will move 5000 items to the new folder. This can be repeated as required.

Once done the required emails should have been moved from within the client.