Pruning “Trash” and “Spam” folders automatically

The accountpruner is a powerful tool, but it’s not always the easiest gizmo to figure out. With that in mind, here are some rules from my \MDaemon\App\midnight.bat file that might be useful.

c:\MDaemon\App\AccountPrune.exe /m /d=28 /p=”Spam.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=28 /p=”Junk Mail.IMAP”
c:\MDaemon\App\AccountPrune.exe /m /d=28 /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”

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 28 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.

CC BY-NC-ND 4.0 Pruning “Trash” and “Spam” folders automatically by Dave Warren (everything-mdaemon.com) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

*