Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » KMS Old Message Deleter
  •  
hcardwell

Messages: 2
Karma: 0
Send a private message to this user
I've attached a Perl script I've written to clean old messages out of my company's mail store. Use of scripts like this that operate on the data store are described as "risky" and completely unsupported by Kerio, so use this at your own risk.

** It should be run with Kerio stopped **

In its current revision, the script does the following:
  • Traverse a passed-in directory looking for Kerio message folders
  • Delete messages older than N days (defaults to 90)
  • Writes logs of action taken both in plain text and HTML
  • Ignores public folders
  • Optional shorter age-out for "special" folders. I use this so that items are purged from folders like "Deleted Items" and "spam" at 30 days instead of 90.
  • When individual folders are altered, renames the index.fld to index.bad to trigger an index rebuild.
  • Removes the stats file to trigger quota resets on altered folders
  • Provides summary statistics after running


The script should work correctly on Linux servers as well as Windows, as I went out of my way to not use platform-specific semantics. However, I've not yet had a chance to test it on a Linux server.

To use it you'll need a working Perl distribution (I use the free ActivePerl 5.8 from ActiveState) and two additional modules. Both modules one can install from ppm. Just run "ppm" and at the ppm> prompt type "install TimeDate" and after it finishes type "install Time-Interval".

By default it runs in "read-only" mode, just generating logs you can look at to see what it'll do. You have to pass in the -W parameter to have it write to the filesystem.

Some sample command lines:
Print out help:
perl kms_dom.pl

Delete messages older than 90 days from one site -- no -W specifiied, so it only logs action taken:
perl kms_dom.pl -d 90 -s e:\Kerio\store\mail\foo.com

Do the same, but delete anything in spam / junk / deleted if it's more than 30 days old and actually perform the actions:
perl kms_dom.pl -d 90 -s e:\Kerio\store\mail\foo.com -f 30 -W

As with most things you get on the Internet, there is no warranty associated with this script, either expressed or implied.

If you want to test it, I'd suggest making a copy of your store and testing it against that first (which is how I developed it).

Cheers.

  •  
Kerio_ktrumbull

Messages: 597
Karma: 2
Send a private message to this user
I have to say that I am not in favor of this script. Any script that auto-deletes mail always spells trouble for us (tech support). Typical scenario: An admin uses a script like this, then a few days later a user calls the admin to report that some of their mail is missing. Admin calls us and asks us why Kerio MailServer deleted their user's mail with no mention of using hacked, unsupported scripts. This is why we do not like these types of scripts.

This script is not supported or condoned by Kerio Technologies, Inc. This script will break the following features of Kerio MailServer: Entourage Synchronization, Quotas, Backups, ActiveSync Synchronization, and possibly more.

Kevin Trumbull
Kerio Technical Support Team Leader
http://support.kerio.com
  •  
hcardwell

Messages: 2
Karma: 0
Send a private message to this user
I fully recognize that this script (while IMO quite useful) is frowned upon. I even explicitly mention that both in my post and in the text of the script. However, its use compensates for what I believe are two glaring issues with KMS.

1) The quota system is inadequate. Having inbound messages bounce when a user's quota is exceeded is inelegant. Blocking sending of messages by that user (via denying SMTP auth, webmail sending, etc.) would suffice for quota enforcement. Having a bizdev person miss an important inbound message because he elected to ignore his quota messages isn't a defensible scenario in my opinion. As CIO of a company running KMS rather than Exchange I think I've voted with my feet, but this is one area where I believe Exchange's implementation is substantially more refined.
2) KMS appears to lack an internal mechanism by which one can purge aged messages out of everyone's store. There are a variety of practical reasons -- both technical and procedural -- that this capability is necessary in some organizations. For an organization with a roaming user base without something like Outlook's Auto-Archive available this appears to be the only viable solution.

If I'm wrong and the above are errors of ignorance I apologize and hope someone will correct me. In the mean time, this script is useful to me and I thought I'd share it.

With respects to the support issue you cite I certainly agree. In the case of my company this script is used to support an unambiguous (and oft-repeated) policy we have with respects to information retention. Using it sight-unseen would no doubt raise many objections in my organization as well.

Regards,
Howard

[Updated on: Tue, 12 December 2006 20:10]

  •  
geebee75

Messages: 2
Karma: 0
Send a private message to this user
Kerio_ktrumbull wrote on Tue, 12 December 2006 19:47
I have to say that I am not in favor of this script. Any script that auto-deletes mail always spells trouble for us (tech support). Typical scenario: An admin uses a script like this, then a few days later a user calls the admin to report that some of their mail is missing. Admin calls us and asks us why Kerio MailServer deleted their user's mail with no mention of using hacked, unsupported scripts. This is why we do not like these types of scripts.


We can all appreciate that argument, however if Kerio had some command-line utilities available to do these very common administrative tasks, people wouldn't have to hack their own solutions.

I've never encountered an office where the users aren't mostly brain-dead when it comes to properly maintaining their mailboxes. Sysadmins HAVE to have the ability to do things like archive/delete email that is more than "X" days old, move mail around, etc. Since Kerio doesn't offer anything like that (that I can find), we have to hack around.

Today, for example, I had to archive some executive's email (anything over a year old - 1.2GB worth) offline. Using IMAP and a mail client to move that kind of volume is unreasonable. So, yes, due to a lack of Kerio tools to do this, I had to do a find/move at the command line, reindex, remove status.usr.

Expecting the end-user to manage their own email and not go over-quota requiring sysadmin intervention is unrealistic.

Just my thoughts.
  •  
freakinvibe

Messages: 1529
Karma: 60
Send a private message to this user
Since the original post was written (December 2006), Kerio has at least introduced automatic recycle bin and junk deletion. In the operations log you can see what has been deleted.

Dexion AG - The Blackberry Specialists in Switzerland
https://dexionag.ch
  •  
geebee75

Messages: 2
Karma: 0
Send a private message to this user
freakinvibe wrote on Thu, 31 December 2009 08:19
Since the original post was written (December 2006), Kerio has at least introduced automatic recycle bin and junk deletion. In the operations log you can see what has been deleted.


Which is good, IF the end-user has the brains enough to actually use their Delete key. A lot don't. They just leave everything - spam included - in their inboxes. (Sales people are famous for this). Smile

Previous Topic: Date value in Sieve
Next Topic: Accessing KMS address book in Thunderbird
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Sun Sep 24 05:23:37 CEST 2017

Total time taken to generate the page: 0.00507 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.