Products: IMail Server Plus, IMail Server Premium, IMail Server

How to delete mail older than thirty days

« Go Back

Information

 
Description
We have users who use Web Messaging or IMAP accounts. I would like to have all mail on the server automatically deleted once it has remained on the server more than 30 days. Is it possible to automate the "delete by date" functions in IMail?
Solution
To automate this function, use the IMail Message Expunger (immsgexp.exe). This command line application is located in your IMail program directory (usually C:\Program Files (x86)\Ipswitch\IMail).

Usage:
immsgexp.exe -tstartdir -dnumdays -mmailbox.mbx
-t path to starting directory to perform a recursive search for mailboxes.
-d maximum number of days a message can be and still be kept. Any mail older than d days will be deleted.
-m filename of the mailbox to search

If you want to delete all mail that is older than 14 days from all your user's 'Deleted Items' folder, use the following syntax:

immsgexp.exe -tc:\imail -d14 -mdeleted.mbx


Usage:
immsgexp.exe -tstartdir -dnumdays
-t path to starting directory to perform a recursive search for mailboxes.
-d maximum number of days a message can be and still be kept. Any mail older than d days will be deleted.

If you assume that IMail is installed on the C drive and all of your domain's TopĀ  Directories are sub-directories of the C:\IMail directory, use the following syntax if you want to purge all mail older than 30 days for all your domains:

immsgexp.exe -tc:\imail -d30

Otherwise, you can give the actual Top Directory path for a domain, or the path to a specific user's mailbox directory.

immsgexp.exe -tc:\imail\domain_com\Users -d30

immsgexp.exe -tc:\imail\domain_com\Users\bob -d30

You can create a .bat file and then setup a Scheduled task with the operating system's Task Scheduler application to run this utility as often as you'd like.
The .bat file could look like:

C:
cd "C:\Program Files(x86)\Ipswitch\IMail"
immsgexp.exe -t"C:\Program Files (x86)\Ipswitch\IMail" -d14 -mspam.mbx

Of course you would need to edit it to match your installation of IMail, the location of users' mailbox files, and the specified name of the mailbox file you wish to expunge.

"Double quotes" are required if any path or your mailbox file has spaces in the file name:
immsgexp.exe -td:\imail\users -d7 -m"Junk E-mail.mbx"

VersionAll Versions
Attachment 

 
Customer Service Softwaresalesforce.comHome | Product