Friday, December 5, 2008

Pruning "Trash" and "Spam" folders automatically on MDaemon

The accountpruner is a powerful tool, but it’s not always the easiest thing to use. With that in mind, here are some rules from my \MDaemon\App\midnight.bat file that might be useful. This batch file is executed by MDaemon at midnight each night. (If you haven't this file, you can create it and it works).

c:\MDaemon\App\AccountPrune.exe /m /d=10 /p=”Spam.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=10 /p=”Junk Mail.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=10 /p=”Junk E-mail.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=2 /p=”Trash.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=2 /p=”Deleted Items.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=2 /p=”Deleted Messages.IMAP”

Obviously, if you have installed MDaemon server in an another path, just use it.

The result is that at midnight each night, MDaemon’s accountpruner will go through each user’s mailbox, and in each of the “Spam”, “Junk Mail” and “Junk E-Mail” folders, delete all messages over 10 days old.

In the “Trash”, “Deleted Items” and “Deleted Messages” folders, messages over 2 days old will be deleted. Combine this with the accountpruner’s own options to delete IMAP mail flagged as deleted, and you’ll have a solution that works for users of all mail clients, whether the mail client uses a dedicated “Trash” folder, uses IMAP deleted flag, or both.

No comments: