Difference between revisions of "Archiving e-mails"

From support-works
Jump to navigation Jump to search
Line 1: Line 1:
Emails should be archived periodically in order to avoid performance issues caused by a large number of emails in the database.
+
Emails should be archived periodically in order to avoid performance issues caused by attempting retrieve a large number of emails via the client each time a folder / sub-folder is accessed. The following method Archives emails by moving the mail to folders / sub-folders within the Mailbox folder structure.  It should be noted that the maximum recommended number of emails in each folder/sub-folder should not exceed 5000.
  
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.
+
Administrators can create folders and sub-folders and subsequently move mail messages to them via MySQL. However before proceeding, it is recommended that a full server backup is taken.
 
 
Solution:
 
Below is the procedure for archiving:
 
  
 +
The following describes the necessary steps for the procedure (replace ‘MAILBOX’ with the name of the Shared Mailbox):
  
 
<code>Use Sw_Messagestore;<br/>
 
<code>Use Sw_Messagestore;<br/>
Select * from Shared__MBName_folders;</code>
+
Select * from Shared__MAILBOX_folders;</code>
 
 
A list of folders and IDs will now be shown. Make a note of the results.
 
  
 +
A list of folders and IDs will now be shown, make a note of the results.
  
 
Moving Emails to Subfolders:
 
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):
+
You will be required to create the new folders / subfolders (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 root set to 0) and ‘folderName’ with the appropriate value):
  
 
<code>Insert into Shared__MAILBOX_folders (folderparent, foldername, folderhaschild, folderunreadcount) values ( FolderParent, 'FolderName', 0,0 );</code>
 
<code>Insert into Shared__MAILBOX_folders (folderparent, foldername, folderhaschild, folderunreadcount) values ( FolderParent, 'FolderName', 0,0 );</code>
  
Once done, the administrator needs to obtain the FolderID for the newly created folder by running the following query:  
+
Once completed, FolderID for the newly created folder can be obtained by running the following query:  
  
 
<code>Select folderid from shared__MAILBOX_folders where foldername = 'FolderName';</code>
 
<code>Select folderid from shared__MAILBOX_folders where foldername = 'FolderName';</code>
Line 29: Line 26:
 
This will move 5000 items to the new folder. This can be repeated as required.
 
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.
+
Once completed the emails will now be visible within the new folders from within the client.

Revision as of 14:24, 11 August 2015

Emails should be archived periodically in order to avoid performance issues caused by attempting retrieve a large number of emails via the client each time a folder / sub-folder is accessed. The following method Archives emails by moving the mail to folders / sub-folders within the Mailbox folder structure. It should be noted that the maximum recommended number of emails in each folder/sub-folder should not exceed 5000.

Administrators can create folders and sub-folders and subsequently move mail messages to them via MySQL. However before proceeding, it is recommended that a full server backup is taken.

The following describes the necessary steps for the procedure (replace ‘MAILBOX’ with the name of the Shared Mailbox):

Use Sw_Messagestore;
Select * from Shared__MAILBOX_folders;

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

Moving Emails to Subfolders:

You will be required to create the new folders / subfolders (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 root set to 0) and ‘folderName’ with the appropriate value):

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

Once completed, FolderID for the newly created folder can be obtained 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 completed the emails will now be visible within the new folders from within the client.